diff --git a/src/compiler/lr/item.cpp b/src/compiler/lr/item.cpp index 21721873..233acfbd 100644 --- a/src/compiler/lr/item.cpp +++ b/src/compiler/lr/item.cpp @@ -44,11 +44,11 @@ namespace tree_sitter { std::ostream& operator<<(ostream &stream, const Item &item) { stream << - string("(item '") << + string("#"); return stream; } } diff --git a/src/compiler/lr/item_set.cpp b/src/compiler/lr/item_set.cpp index 987cf4e5..517aa99e 100644 --- a/src/compiler/lr/item_set.cpp +++ b/src/compiler/lr/item_set.cpp @@ -77,12 +77,12 @@ namespace tree_sitter { #pragma mark - printing ostream& operator<<(ostream &stream, const ItemSet &item_set) { - stream << string("(item_set "); + stream << string("#"); return stream; } } diff --git a/src/compiler/lr/lex_table.cpp b/src/compiler/lr/lex_table.cpp index f980de32..89af6974 100644 --- a/src/compiler/lr/lex_table.cpp +++ b/src/compiler/lr/lex_table.cpp @@ -37,11 +37,11 @@ namespace tree_sitter { std::ostream& operator<<(std::ostream &stream, const LexAction &action) { switch (action.type) { case LexActionTypeError: - return stream << string("(error)"); + return stream << string("#"); case LexActionTypeAccept: - return stream << string("(accept ") + action.symbol_name + ")"; + return stream << string("#"; case LexActionTypeAdvance: - return stream << string("(advance ") + to_string(action.state_index) + ")"; + return stream << string("#"; } } diff --git a/src/compiler/lr/parse_table.cpp b/src/compiler/lr/parse_table.cpp index 6a4f19c6..fdb523ea 100644 --- a/src/compiler/lr/parse_table.cpp +++ b/src/compiler/lr/parse_table.cpp @@ -37,13 +37,13 @@ namespace tree_sitter { ostream& operator<<(ostream &stream, const ParseAction &action) { switch (action.type) { case ParseActionTypeError: - return stream << string("error"); + return stream << string("#"); case ParseActionTypeAccept: - return stream << string("accept"); + return stream << string("#"); case ParseActionTypeShift: - return stream << (string("(shift ") + to_string(action.state_index) + ")"); + return stream << (string("#"); case ParseActionTypeReduce: - return stream << (string("(reduce ") + action.symbol_name + ")"); + return stream << (string("#"); } } diff --git a/src/compiler/rules/blank.cpp b/src/compiler/rules/blank.cpp index 5b99e8b3..db011510 100644 --- a/src/compiler/rules/blank.cpp +++ b/src/compiler/rules/blank.cpp @@ -10,7 +10,7 @@ namespace tree_sitter { } std::string Blank::to_string() const { - return "blank"; + return "#"; } void Blank::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/character.cpp b/src/compiler/rules/character.cpp index 1eeeee9f..0f251775 100644 --- a/src/compiler/rules/character.cpp +++ b/src/compiler/rules/character.cpp @@ -15,7 +15,7 @@ namespace tree_sitter { } string Character::to_string() const { - return CharMatchToString(value); + return string("#"; } void Character::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/choice.cpp b/src/compiler/rules/choice.cpp index ac7b57ef..d9c0ab9c 100644 --- a/src/compiler/rules/choice.cpp +++ b/src/compiler/rules/choice.cpp @@ -13,7 +13,7 @@ namespace tree_sitter { } string Choice::to_string() const { - return string("(choice ") + left->to_string() + " " + right->to_string() + ")"; + return string("#to_string() + " " + right->to_string() + ">"; } void Choice::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/pattern.cpp b/src/compiler/rules/pattern.cpp index 970f7a7e..40b9b2e4 100644 --- a/src/compiler/rules/pattern.cpp +++ b/src/compiler/rules/pattern.cpp @@ -109,7 +109,7 @@ namespace tree_sitter { } string Pattern::to_string() const { - return value; + return string("#"; } void Pattern::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/repeat.cpp b/src/compiler/rules/repeat.cpp index d12010e7..9f8ac75e 100644 --- a/src/compiler/rules/repeat.cpp +++ b/src/compiler/rules/repeat.cpp @@ -13,7 +13,7 @@ namespace tree_sitter { } string Repeat::to_string() const { - return string("(repeat ") + content->to_string() + ")"; + return string("#to_string() + ">"; } void Repeat::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/rule.cpp b/src/compiler/rules/rule.cpp index 9185345f..aea595e1 100644 --- a/src/compiler/rules/rule.cpp +++ b/src/compiler/rules/rule.cpp @@ -14,7 +14,7 @@ namespace tree_sitter { if (rule.get()) stream << *rule; else - stream << string("#"); + stream << string("#"); return stream; } } diff --git a/src/compiler/rules/seq.cpp b/src/compiler/rules/seq.cpp index 33bd6f30..4ac99e85 100644 --- a/src/compiler/rules/seq.cpp +++ b/src/compiler/rules/seq.cpp @@ -13,7 +13,7 @@ namespace tree_sitter { } string Seq::to_string() const { - return string("(seq ") + left->to_string() + " " + right->to_string() + ")"; + return string("#to_string() + " " + right->to_string() + ">"; } void Seq::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/string.cpp b/src/compiler/rules/string.cpp index 0cf8faaa..55cb709f 100644 --- a/src/compiler/rules/string.cpp +++ b/src/compiler/rules/string.cpp @@ -13,7 +13,7 @@ namespace tree_sitter { } string String::to_string() const { - return string("(string '") + value + "')"; + return string("#"; } void String::accept(Visitor &visitor) const { diff --git a/src/compiler/rules/symbol.cpp b/src/compiler/rules/symbol.cpp index d815f1ce..cf326216 100644 --- a/src/compiler/rules/symbol.cpp +++ b/src/compiler/rules/symbol.cpp @@ -13,7 +13,7 @@ namespace tree_sitter { } string Symbol::to_string() const { - return string("(sym '") + name + "')"; + return string("#"; } void Symbol::accept(Visitor &visitor) const { diff --git a/src/compiler/util/char_match.cpp b/src/compiler/util/char_match.cpp index 02b8e2b6..fe9b5f47 100644 --- a/src/compiler/util/char_match.cpp +++ b/src/compiler/util/char_match.cpp @@ -36,7 +36,7 @@ namespace tree_sitter { case CharMatchTypeRange: return ( string("'") + - string(&match.value.range.min_character) + "-" + + string(&match.value.range.min_character) + "'-'" + string(&match.value.range.max_character) + "'"); } }