cc: fix typo
This commit is contained in:
10
tools/cc.py
10
tools/cc.py
@@ -313,8 +313,8 @@ class CcTransform(lark.visitors.Transformer):
|
||||
@lark.v_args(tree=True)
|
||||
def _f(self, tree):
|
||||
left, right = tree.children
|
||||
if left.data == 'litteral' and right.data == 'litteral':
|
||||
tree.data = 'litteral'
|
||||
if left.data == 'literal' and right.data == 'literal':
|
||||
tree.data = 'literal'
|
||||
tree.children = [litt(left.children[0], right.children[0])]
|
||||
return tree
|
||||
return _f
|
||||
@@ -360,7 +360,7 @@ class CcTransform(lark.visitors.Transformer):
|
||||
addop = lark.Tree('add', children)
|
||||
return lark.Tree('dereference', [addop])
|
||||
|
||||
# operations on litterals can be done by the compiler
|
||||
# operations on literals can be done by the compiler
|
||||
add = _binary_op(lambda a, b: a+b)
|
||||
sub = _binary_op(lambda a, b: a-b)
|
||||
mul = _binary_op(lambda a, b: a*b)
|
||||
@@ -862,7 +862,7 @@ class CcInterp(lark.visitors.Interpreter):
|
||||
self.global_scope.symbols[token] = Variable(litt_type(s), token)
|
||||
return token
|
||||
|
||||
def litteral(self, tree):
|
||||
def literal(self, tree):
|
||||
imm = tree.children[0]
|
||||
if isinstance(imm, str):
|
||||
tok = self._make_string(imm)
|
||||
@@ -1064,7 +1064,7 @@ class CcInterp(lark.visitors.Interpreter):
|
||||
strct = self.global_scope.structs[type.struct]
|
||||
offs = strct.offset(ch_field)
|
||||
if offs > 0:
|
||||
load_offs = lark.Tree('litteral', [offs])
|
||||
load_offs = lark.Tree('literal', [offs])
|
||||
addop = lark.Tree('add', [tree.children[0], load_offs])
|
||||
self.visit(addop)
|
||||
addop.type = PointerType(pointed=strct.field_type(ch_field))
|
||||
|
||||
Reference in New Issue
Block a user