refact: release input from ParserContext.
This commit is contained in:
@@ -109,7 +109,7 @@ pub fn nom_lexical_parser(mut input: &str) -> IResult<&str, Vec<LexicalToken>> {
|
||||
}
|
||||
|
||||
pub fn zero_lexical_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
mut input: &[char],
|
||||
) -> ParserResult<char, Vec<NewLexicalToken>> {
|
||||
let mut array = vec![];
|
||||
|
@@ -9,7 +9,7 @@ use zero_parser::text::{char_parser, one_of, string_parser};
|
||||
use zero_parser::{alternate, parser::satisfy};
|
||||
|
||||
pub fn keyword_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
tuple((
|
||||
@@ -38,7 +38,7 @@ pub fn keyword_parser(
|
||||
}
|
||||
|
||||
pub fn delimiter_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
alternate!(
|
||||
@@ -60,7 +60,7 @@ pub fn delimiter_parser(
|
||||
}
|
||||
|
||||
pub fn operator_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
alternate!(
|
||||
@@ -89,7 +89,7 @@ pub fn operator_parser(
|
||||
}
|
||||
|
||||
pub fn identifier_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
tuple((
|
||||
@@ -105,7 +105,7 @@ pub fn identifier_parser(
|
||||
}
|
||||
|
||||
pub fn decimal_integer_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
tuple((
|
||||
@@ -126,7 +126,7 @@ pub fn decimal_integer_parser(
|
||||
}
|
||||
|
||||
pub fn octal_integer_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
tuple((
|
||||
@@ -147,7 +147,7 @@ pub fn octal_integer_parser(
|
||||
}
|
||||
|
||||
pub fn hexadecimal_integer_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
tuple((
|
||||
@@ -168,7 +168,7 @@ pub fn hexadecimal_integer_parser(
|
||||
}
|
||||
|
||||
pub fn integer_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
alternate!(
|
||||
@@ -180,7 +180,7 @@ pub fn integer_parser(
|
||||
}
|
||||
|
||||
pub fn float_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
tuple((
|
||||
@@ -202,7 +202,7 @@ pub fn float_parser(
|
||||
}
|
||||
|
||||
pub fn literal_string_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
quote(char_parser('"'), any(), char_parser('"'))
|
||||
@@ -218,7 +218,7 @@ pub fn literal_string_parser(
|
||||
}
|
||||
|
||||
pub fn comments_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, ()> {
|
||||
alternate!(
|
||||
@@ -239,7 +239,7 @@ pub fn comments_parser(
|
||||
}
|
||||
|
||||
pub fn junk_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, ()> {
|
||||
alternate!(
|
||||
@@ -250,7 +250,7 @@ pub fn junk_parser(
|
||||
}
|
||||
|
||||
pub fn combine_parser(
|
||||
context: Rc<RefCell<ParserContext<char, ()>>>,
|
||||
context: Rc<RefCell<ParserContext<()>>>,
|
||||
input: &[char],
|
||||
) -> ParserResult<char, NewLexicalToken> {
|
||||
alternate!(
|
||||
|
Reference in New Issue
Block a user