valauska...@gmail.com
unread,Dec 21, 2022, 6:41:26 PM12/21/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dart Analyzer Discussion
I'm working on an autogenerated lexer for Dart. I'd like to confirm that its output matches the one in _fe_analyzer_shared.
I'm trying to map the tokens that the scanner in _fe_analyzer_shared emits to my tokens. However, there are some things that I did not expect and don't know how to deal with. I wanted to ask for help with how to handle the following:
* Is there a way to extract the nested structure of a Token with .type == TokenType.MULTI_LINE_COMMENT? Or does the scanner not expose this information? (By nested structure I'm referring to the nestedness of multi line comments i.e. the fact that '/* /* */ */' are two multiline comments where one can be found inside of the other.)
* All Strings, complete ones such as '"foo"' and incomplete ones that are part of an interpolated string such as '"""foo' are emitted under .type == TokenType.STRING. Is there a way to extract their type (i.e. whether they represent a single line single quote string, a single line double quote string and so on) or would I have to examine the lexeme to discover this information?
* What is the purpose of TokenType.BACKPING and TokenType.BACKSLASH? It looks to me like they are used for error recovery and will not appear in code that represents a valid Dart token stream. Is that correct?
* Keyword.PATCH and Keyword.SOURCE don't seem to be part of the official lexical grammar. Can I safely ignore them or is there some Dart code that I should expect to contain these tokens?
* It looks to me like whitespace information (e.g. spaces, tabs, newlines) is dropped and there's no way to extract some sort of "WhitespaceToken". Is that correct?