diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-02-20 23:26:57 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-02-20 23:26:57 +0100 |
commit | 10c2b7f9b6676dafd62d0eeda507b5ee5c6db216 (patch) | |
tree | 705885f41d9224e8678578e99db9f80af8136e94 /grammer.cpp | |
parent | ba8520d3435c75c2568c05f1333966a4c1a4d69b (diff) |
Grammar applied to lex (WIP)
Diffstat (limited to 'grammer.cpp')
-rw-r--r-- | grammer.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/grammer.cpp b/grammer.cpp index a54b65d..8243fa8 100644 --- a/grammer.cpp +++ b/grammer.cpp @@ -59,24 +59,20 @@ bool Compiler::rootIsStartSymbol() const return GetTypeOfNode(root_node_id) == Top; } -namespace { - - bool ChildIdIsToken(int32_t child_id) - { - return child_id < 0; - } - - index_t TokenIdFromChildId(int32_t child_id) - { - return index_t(-child_id) - 1; - } +bool Gram::ChildIdIsToken(int32_t child_id) +{ + return child_id < 0; +} - int32_t ChildIdFromTokenId(index_t token_id) - { - return -1 - int32_t(token_id); - } +index_t Gram::TokenIdFromChildId(int32_t child_id) +{ + return index_t(-child_id) - 1; +} -} // namespace +int32_t Gram::ChildIdFromTokenId(index_t token_id) +{ + return -1 - int32_t(token_id); +} void Compiler::DumpTree() { |