@@ -34,6 +34,10 @@ use crate::{
34
34
35
35
use super :: { prim:: token, ParserContext } ;
36
36
37
+ /// Our implementation differs slightly from the grammar in
38
+ /// that we accumulate annotations and append them to the next
39
+ /// consecutive statement.
40
+ ///
37
41
/// Grammar:
38
42
/// ```g4
39
43
/// pragma
@@ -163,6 +167,9 @@ pub(super) fn parse(s: &mut ParserContext) -> Result<Box<Stmt>> {
163
167
} ) )
164
168
}
165
169
170
+ /// This helper function allows us to disambiguate between
171
+ /// non-constant declarations and cast expressions when
172
+ /// reading a `TypeDef`.
166
173
fn disambiguate_type ( s : & mut ParserContext , ty : TypeDef ) -> Result < StmtKind > {
167
174
let lo = ty. span ( ) . lo ;
168
175
if matches ! ( s. peek( ) . kind, TokenKind :: Identifier ) {
@@ -186,6 +193,10 @@ fn disambiguate_type(s: &mut ParserContext, ty: TypeDef) -> Result<StmtKind> {
186
193
}
187
194
}
188
195
196
+ /// This helper function allows us to disambiguate between
197
+ /// assignments, assignment operations, gate calls, and
198
+ /// expr_stmts beginning with an ident or a function call
199
+ /// when reading an `Ident`.
189
200
fn disambiguate_ident ( s : & mut ParserContext , indexed_ident : IndexedIdent ) -> Result < StmtKind > {
190
201
let lo = indexed_ident. span . lo ;
191
202
if s. peek ( ) . kind == TokenKind :: Eq {
0 commit comments