-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lex: advancement in lexer development #9
Conversation
Signed-off-by: FedericoBruzzone <[email protected]>
Signed-off-by: FedericoBruzzone <[email protected]>
Bool(bool), | ||
Char(char), | ||
} | ||
const DOUBLE_TICK: &str = "\""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In english is called quotation mark or similar :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, I can call it DOUBLE_QUOTE
but for consistency we should rename the TICK to SINGLE_QUOTE
.
What do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok make sense
{ "kind": "TokenIdentifier", "lexeme": "x", "location": { "file_path": "", "line": 1, "column_start": 0, "column_end": 1 } }, | ||
{ "kind": "TokenWord", "lexeme": "x", "location": { "file_path": "", "line": 1, "column_start": 0, "column_end": 1 } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually an identifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the lexer we should find a name for all the words.
You know that this is an identifier because of its position.
For instance, a word (or multiple words) between "
or '
is not an identifier, but and we have called this word so far Identifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var x = 10 -> x identifier
var y = "x" -> x is a word/string and Y identifier
I mean, word is a bit useless
literal
token kind multiple partsstr
var init