Skip to content
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

James.yang/lexer trie impl #13

Open
wants to merge 23 commits into
base: james.yang/lexer_refactor
Choose a base branch
from

Conversation

JamesYang007
Copy link
Owner

An entirely new, automated way of defining lexer. A special Trie-like object has been introduced to represent a compressed version of all strings to tokenize. Lexer manages this Trie object to change states accordingly.

STAR,
OPEN_BRACE,
CLOSE_BRACE,
// string tokens
BEGIN_LINE_COMMENT,
BEGIN_BLOCK_COMMENT,
BEGIN_SLINE_COMMENT,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S means Special

BEGIN_BLOCK_COMMENT,
BEGIN_SLINE_COMMENT,
BEGIN_SBLOCK_COMMENT,
BEGIN_NLINE_COMMENT,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N means Normal

END_BLOCK_COMMENT,
// special tags
TAGNAME,
SDESC,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, I only support these tag names, but it's easy to add more.

@@ -31,8 +38,10 @@ static MAPBOX_ETERNAL_CONSTEXPR const auto symbol_map =
{Symbol::STAR, "*"},
{Symbol::OPEN_BRACE, "{"},
{Symbol::CLOSE_BRACE, "}"},
{Symbol::BEGIN_LINE_COMMENT, "///"},
{Symbol::BEGIN_BLOCK_COMMENT, "/*!"},
{Symbol::BEGIN_SLINE_COMMENT, "///"},
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not quite sure how you use this, so let me know if you want me to add more entires for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant