parser.py (9219:258753d3bc47) parser.py (9271:3859f5d4f2c6)
1# Copyright (c) 2009 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 107 unchanged lines hidden (view full) ---

116 'check_allocate' : 'CHECK_ALLOCATE',
117 'check_stop_slots' : 'CHECK_STOP_SLOTS',
118 'static_cast' : 'STATIC_CAST',
119 'if' : 'IF',
120 'is_valid' : 'IS_VALID',
121 'is_invalid' : 'IS_INVALID',
122 'else' : 'ELSE',
123 'return' : 'RETURN',
1# Copyright (c) 2009 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 107 unchanged lines hidden (view full) ---

116 'check_allocate' : 'CHECK_ALLOCATE',
117 'check_stop_slots' : 'CHECK_STOP_SLOTS',
118 'static_cast' : 'STATIC_CAST',
119 'if' : 'IF',
120 'is_valid' : 'IS_VALID',
121 'is_invalid' : 'IS_INVALID',
122 'else' : 'ELSE',
123 'return' : 'RETURN',
124 'THIS' : 'THIS',
125 'CHIP' : 'CHIP',
126 'void' : 'VOID',
127 'new' : 'NEW',
128 'OOD' : 'OOD',
129 }
130
131 literals = ':[]{}(),='
132
133 tokens = [ 'EQ', 'NE', 'LT', 'GT', 'LE', 'GE',

--- 480 unchanged lines hidden (view full) ---

614 def p_expr__new(self, p):
615 "aexpr : NEW type"
616 p[0] = ast.NewExprAST(self, p[2])
617
618 def p_expr__null(self, p):
619 "aexpr : OOD"
620 p[0] = ast.OodAST(self)
621
124 'void' : 'VOID',
125 'new' : 'NEW',
126 'OOD' : 'OOD',
127 }
128
129 literals = ':[]{}(),='
130
131 tokens = [ 'EQ', 'NE', 'LT', 'GT', 'LE', 'GE',

--- 480 unchanged lines hidden (view full) ---

612 def p_expr__new(self, p):
613 "aexpr : NEW type"
614 p[0] = ast.NewExprAST(self, p[2])
615
616 def p_expr__null(self, p):
617 "aexpr : OOD"
618 p[0] = ast.OodAST(self)
619
622 # globally access a local chip component and call a method
623 def p_expr__local_chip_method(self, p):
624 "aexpr : THIS DOT var '[' expr ']' DOT var DOT ident '(' exprs ')'"
625 p[0] = ast.LocalChipMethodAST(self, p[3], p[5], p[8], p[10], p[12])
626
627 # globally access a local chip component and access a data member
628 def p_expr__local_chip_member(self, p):
629 "aexpr : THIS DOT var '[' expr ']' DOT var DOT field"
630 p[0] = ast.LocalChipMemberAST(self, p[3], p[5], p[8], p[10])
631
632 # globally access a specified chip component and call a method
633 def p_expr__specified_chip_method(self, p):
634 "aexpr : CHIP '[' expr ']' DOT var '[' expr ']' DOT var DOT ident '(' exprs ')'"
635 p[0] = ast.SpecifiedChipMethodAST(self, p[3], p[6], p[8], p[11], p[13],
636 p[15])
637
638 # globally access a specified chip component and access a data member
639 def p_expr__specified_chip_member(self, p):
640 "aexpr : CHIP '[' expr ']' DOT var '[' expr ']' DOT var DOT field"
641 p[0] = ast.SpecifiedChipMemberAST(self, p[3], p[6], p[8], p[11], p[13])
642
643 def p_expr__member(self, p):
644 "aexpr : aexpr DOT ident"
645 p[0] = ast.MemberExprAST(self, p[1], p[3])
646
647 def p_expr__member_method_call(self, p):
648 "aexpr : aexpr DOT ident '(' exprs ')'"
649 p[0] = ast.MemberMethodCallExprAST(self, p[1], p[3], p[5])
650

--- 62 unchanged lines hidden (view full) ---

713
714 def p_enumeration(self, p):
715 "enumeration : ident ':' ident"
716 p[0] = ast.EnumExprAST(self, ast.TypeAST(self, p[1]), p[3])
717
718 def p_var(self, p):
719 "var : ident"
720 p[0] = ast.VarExprAST(self, p[1])
620 def p_expr__member(self, p):
621 "aexpr : aexpr DOT ident"
622 p[0] = ast.MemberExprAST(self, p[1], p[3])
623
624 def p_expr__member_method_call(self, p):
625 "aexpr : aexpr DOT ident '(' exprs ')'"
626 p[0] = ast.MemberMethodCallExprAST(self, p[1], p[3], p[5])
627

--- 62 unchanged lines hidden (view full) ---

690
691 def p_enumeration(self, p):
692 "enumeration : ident ':' ident"
693 p[0] = ast.EnumExprAST(self, ast.TypeAST(self, p[1]), p[3])
694
695 def p_var(self, p):
696 "var : ident"
697 p[0] = ast.VarExprAST(self, p[1])
721
722 def p_field(self, p):
723 "field : ident"
724 p[0] = p[1]