From 10c2b7f9b6676dafd62d0eeda507b5ee5c6db216 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 20 Feb 2020 23:26:57 +0100 Subject: Grammar applied to lex (WIP) --- grammer.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'grammer.cpp') 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() { -- cgit v1.2.3