parser.py (6877:2a1a3d916ca8) parser.py (6882:898047a3672c)
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

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

149 'structure' : 'STRUCT',
150 'external_type' : 'EXTERN_TYPE',
151 'enumeration' : 'ENUM',
152 'peek' : 'PEEK',
153 'enqueue' : 'ENQUEUE',
154 'copy_head' : 'COPY_HEAD',
155 'check_allocate' : 'CHECK_ALLOCATE',
156 'check_stop_slots' : 'CHECK_STOP_SLOTS',
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

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

149 'structure' : 'STRUCT',
150 'external_type' : 'EXTERN_TYPE',
151 'enumeration' : 'ENUM',
152 'peek' : 'PEEK',
153 'enqueue' : 'ENQUEUE',
154 'copy_head' : 'COPY_HEAD',
155 'check_allocate' : 'CHECK_ALLOCATE',
156 'check_stop_slots' : 'CHECK_STOP_SLOTS',
157 'static_cast' : 'STATIC_CAST',
157 'if' : 'IF',
158 'else' : 'ELSE',
159 'return' : 'RETURN',
160 'THIS' : 'THIS',
161 'CHIP' : 'CHIP',
162 'void' : 'VOID',
163 'new' : 'NEW',
164 }

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

411 def p_params__none(self, p):
412 "params : empty"
413 p[0] = []
414
415 def p_param(self, p):
416 "param : type ident"
417 p[0] = ast.FormalParamAST(self, p[1], p[2])
418
158 'if' : 'IF',
159 'else' : 'ELSE',
160 'return' : 'RETURN',
161 'THIS' : 'THIS',
162 'CHIP' : 'CHIP',
163 'void' : 'VOID',
164 'new' : 'NEW',
165 }

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

412 def p_params__none(self, p):
413 "params : empty"
414 p[0] = []
415
416 def p_param(self, p):
417 "param : type ident"
418 p[0] = ast.FormalParamAST(self, p[1], p[2])
419
420 def p_param__pointer(self, p):
421 "param : type STAR ident"
422 p[0] = ast.FormalParamAST(self, p[1], p[3], None, True)
423
419 def p_param__default(self, p):
420 "param : type ident '=' NUMBER"
421 p[0] = ast.FormalParamAST(self, p[1], p[2], p[4])
422
423 # Idents and lists
424 def p_idents__braced(self, p):
425 "idents : '{' identx '}'"
426 p[0] = p[2]

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

526 def p_statement__check_allocate(self, p):
527 "statement : CHECK_ALLOCATE '(' var ')' SEMI"
528 p[0] = ast.CheckAllocateStatementAST(self, p[3])
529
530 def p_statement__check_stop(self, p):
531 "statement : CHECK_STOP_SLOTS '(' var ',' STRING ',' STRING ')' SEMI"
532 p[0] = ast.CheckStopStatementAST(self, p[3], p[5], p[7])
533
424 def p_param__default(self, p):
425 "param : type ident '=' NUMBER"
426 p[0] = ast.FormalParamAST(self, p[1], p[2], p[4])
427
428 # Idents and lists
429 def p_idents__braced(self, p):
430 "idents : '{' identx '}'"
431 p[0] = p[2]

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

531 def p_statement__check_allocate(self, p):
532 "statement : CHECK_ALLOCATE '(' var ')' SEMI"
533 p[0] = ast.CheckAllocateStatementAST(self, p[3])
534
535 def p_statement__check_stop(self, p):
536 "statement : CHECK_STOP_SLOTS '(' var ',' STRING ',' STRING ')' SEMI"
537 p[0] = ast.CheckStopStatementAST(self, p[3], p[5], p[7])
538
539 def p_statement__static_cast(self, p):
540 "aexpr : STATIC_CAST '(' type ',' expr ')'"
541 p[0] = ast.StaticCastAST(self, p[3], p[5])
542
534 def p_statement__return(self, p):
535 "statement : RETURN expr SEMI"
536 p[0] = ast.ReturnStatementAST(self, p[2])
537
538 def p_statement__if(self, p):
539 "statement : if_statement"
540 p[0] = p[1]
541

--- 128 unchanged lines hidden ---
543 def p_statement__return(self, p):
544 "statement : RETURN expr SEMI"
545 p[0] = ast.ReturnStatementAST(self, p[2])
546
547 def p_statement__if(self, p):
548 "statement : if_statement"
549 p[0] = p[1]
550

--- 128 unchanged lines hidden ---