slightly better names
This commit is contained in:
parent
ca22477511
commit
671ddb5a2f
|
@ -458,8 +458,7 @@ pub fn lex_signature(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporary name because i cant decide on a better one
|
pub fn lex_alternating_special_tokens(
|
||||||
pub fn lex_but_ignore_specials_after_special(
|
|
||||||
input: &[u8],
|
input: &[u8],
|
||||||
span_offset: usize,
|
span_offset: usize,
|
||||||
additional_whitespace: &[u8],
|
additional_whitespace: &[u8],
|
||||||
|
@ -505,7 +504,7 @@ fn lex_internal(
|
||||||
in_signature: bool,
|
in_signature: bool,
|
||||||
// after lexing a special item, disable special items when lexing the next item.
|
// after lexing a special item, disable special items when lexing the next item.
|
||||||
// necessary because colons are special in records, but datetime literals may contain colons
|
// necessary because colons are special in records, but datetime literals may contain colons
|
||||||
ignore_specials_after_special: bool,
|
alternate_specials: bool,
|
||||||
) -> (Vec<Token>, Option<ParseError>) {
|
) -> (Vec<Token>, Option<ParseError>) {
|
||||||
let mut specials_disabled = false;
|
let mut specials_disabled = false;
|
||||||
|
|
||||||
|
@ -638,8 +637,7 @@ fn lex_internal(
|
||||||
} else if c == b' ' || c == b'\t' || additional_whitespace.contains(&c) {
|
} else if c == b' ' || c == b'\t' || additional_whitespace.contains(&c) {
|
||||||
// If the next character is non-newline whitespace, skip it.
|
// If the next character is non-newline whitespace, skip it.
|
||||||
curr_offset += 1;
|
curr_offset += 1;
|
||||||
} else if ignore_specials_after_special && !specials_disabled && special_tokens.contains(&c)
|
} else if alternate_specials && !specials_disabled && special_tokens.contains(&c) {
|
||||||
{
|
|
||||||
// If disabling special items but if they're not currently disabled, handle a special item
|
// If disabling special items but if they're not currently disabled, handle a special item
|
||||||
// character right here, bypassing lex_item
|
// character right here, bypassing lex_item
|
||||||
output.push(Token::new(
|
output.push(Token::new(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
lex::{is_assignment_operator, lex, lex_but_ignore_specials_after_special, lex_signature},
|
lex::{is_assignment_operator, lex, lex_alternating_special_tokens, lex_signature},
|
||||||
lite_parser::{lite_parse, LiteCommand, LitePipeline, LiteRedirection, LiteRedirectionTarget},
|
lite_parser::{lite_parse, LiteCommand, LitePipeline, LiteRedirection, LiteRedirectionTarget},
|
||||||
parse_keywords::*,
|
parse_keywords::*,
|
||||||
parse_patterns::parse_pattern,
|
parse_patterns::parse_pattern,
|
||||||
|
@ -5602,7 +5602,7 @@ pub fn parse_record(working_set: &mut StateWorkingSet, span: Span) -> Expression
|
||||||
let source = working_set.get_span_contents(inner_span);
|
let source = working_set.get_span_contents(inner_span);
|
||||||
|
|
||||||
let (tokens, err) =
|
let (tokens, err) =
|
||||||
lex_but_ignore_specials_after_special(source, start, &[b'\n', b'\r', b','], &[b':'], true);
|
lex_alternating_special_tokens(source, start, &[b'\n', b'\r', b','], &[b':'], true);
|
||||||
if let Some(err) = err {
|
if let Some(err) = err {
|
||||||
working_set.error(err);
|
working_set.error(err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user