Commit ac6afe41 authored by Igor Dejanovic's avatar Igor Dejanovic

Some common semantic actions.

parent f6fa97f1
...@@ -835,6 +835,22 @@ class SemanticActionResults(object): ...@@ -835,6 +835,22 @@ class SemanticActionResults(object):
return self.results.get(attr_name, []) return self.results.get(attr_name, [])
# Common semantic actions
class SemanticActionSingleChild(SemanticAction):
def first_pass(self, parser, node, children):
return children[0]
class SemanticActionBodyWithBraces(SemanticAction):
def first_pass(self, parser, node, children):
return children[1:-1]
class SemanticActionToString(SemanticAction):
def first_pass(self, parser, node, children):
return str(node)
# ---------------------------------------------------- # ----------------------------------------------------
# Parsers # Parsers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment