Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/parser/internal/arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ fn array_pair(state: &mut State) -> ParseResult<ArrayItem> {
let mut current = state.stream.current();
let ellipsis = if current.kind == TokenKind::Ellipsis {
state.stream.next();
let span = current.span;
current = state.stream.current();

Some(current.span)
Some(span)
} else {
None
};
Expand Down
28 changes: 17 additions & 11 deletions src/parser/internal/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,25 @@ pub fn name(state: &mut State) -> ParseResult<SimpleIdentifier> {
pub fn optional_name(state: &mut State) -> Option<SimpleIdentifier> {
let current = state.stream.current();

let ident = match &current.kind {
TokenKind::Identifier | TokenKind::QualifiedIdentifier => Some(SimpleIdentifier {
span: current.span,
value: current.value.clone(),
}),
_ => None,
};
match &current.kind {
TokenKind::Identifier | TokenKind::QualifiedIdentifier => {
state.stream.next();

if ident.is_some() {
state.stream.next();
}
Some(SimpleIdentifier {
span: current.span,
value: current.value.clone(),
})
}
t if is_reserved_identifier(t) => {
state.stream.next();

ident
Some(SimpleIdentifier {
span: current.span,
value: current.value.clone(),
})
}
_ => None,
}
}

/// Expect an unqualified, qualified or fully qualified identifier such as Foo, Foo\Bar or \Foo\Bar.
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/0101/ast.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
SpreadValue {
ellipsis: Span {
line: 1,
column: 11,
position: 10,
column: 8,
position: 7,
},
value: ShortArray {
start: Span {
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/0102/ast.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
SpreadValue {
ellipsis: Span {
line: 1,
column: 11,
position: 10,
column: 8,
position: 7,
},
value: ShortArray {
start: Span {
Expand Down Expand Up @@ -56,8 +56,8 @@
SpreadValue {
ellipsis: Span {
line: 1,
column: 19,
position: 18,
column: 16,
position: 15,
},
value: ShortArray {
start: Span {
Expand Down
Loading