parser.py (7055:4e24742201d7) | parser.py (7567:238f99c9f441) |
---|---|
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 --- 143 unchanged lines hidden (view full) --- 152 'in_port' : 'IN_PORT', 153 'out_port' : 'OUT_PORT', 154 'action' : 'ACTION', 155 'transition' : 'TRANS', 156 'structure' : 'STRUCT', 157 'external_type' : 'EXTERN_TYPE', 158 'enumeration' : 'ENUM', 159 'peek' : 'PEEK', | 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 --- 143 unchanged lines hidden (view full) --- 152 'in_port' : 'IN_PORT', 153 'out_port' : 'OUT_PORT', 154 'action' : 'ACTION', 155 'transition' : 'TRANS', 156 'structure' : 'STRUCT', 157 'external_type' : 'EXTERN_TYPE', 158 'enumeration' : 'ENUM', 159 'peek' : 'PEEK', |
160 'stall_and_wait' : 'STALL_AND_WAIT', 161 'wake_up_dependents' : 'WAKE_UP_DEPENDENTS', |
|
160 'enqueue' : 'ENQUEUE', 161 'copy_head' : 'COPY_HEAD', 162 'check_allocate' : 'CHECK_ALLOCATE', 163 'check_stop_slots' : 'CHECK_STOP_SLOTS', 164 'static_cast' : 'STATIC_CAST', 165 'if' : 'IF', 166 'else' : 'ELSE', 167 'return' : 'RETURN', --- 326 unchanged lines hidden (view full) --- 494 495 def p_pairsx__one(self, p): 496 "pairsx : pair" 497 p[0] = ast.PairListAST(self) 498 p[0].addPair(p[1]) 499 500 def p_pair__assign(self, p): 501 """pair : ident '=' STRING | 162 'enqueue' : 'ENQUEUE', 163 'copy_head' : 'COPY_HEAD', 164 'check_allocate' : 'CHECK_ALLOCATE', 165 'check_stop_slots' : 'CHECK_STOP_SLOTS', 166 'static_cast' : 'STATIC_CAST', 167 'if' : 'IF', 168 'else' : 'ELSE', 169 'return' : 'RETURN', --- 326 unchanged lines hidden (view full) --- 496 497 def p_pairsx__one(self, p): 498 "pairsx : pair" 499 p[0] = ast.PairListAST(self) 500 p[0].addPair(p[1]) 501 502 def p_pair__assign(self, p): 503 """pair : ident '=' STRING |
502 | ident '=' ident""" | 504 | ident '=' ident 505 | ident '=' NUMBER""" |
503 p[0] = ast.PairAST(self, p[1], p[3]) 504 505 def p_pair__literal(self, p): 506 "pair : STRING" 507 p[0] = ast.PairAST(self, "short", p[1]) 508 509 # Below are the rules for action descriptions 510 def p_statements__inner(self, p): --- 31 unchanged lines hidden (view full) --- 542 def p_statement__assign(self, p): 543 "statement : expr ASSIGN expr SEMI" 544 p[0] = ast.AssignStatementAST(self, p[1], p[3]) 545 546 def p_statement__enqueue(self, p): 547 "statement : ENQUEUE '(' var ',' type pairs ')' statements" 548 p[0] = ast.EnqueueStatementAST(self, p[3], p[5], p[6], p[8]) 549 | 506 p[0] = ast.PairAST(self, p[1], p[3]) 507 508 def p_pair__literal(self, p): 509 "pair : STRING" 510 p[0] = ast.PairAST(self, "short", p[1]) 511 512 # Below are the rules for action descriptions 513 def p_statements__inner(self, p): --- 31 unchanged lines hidden (view full) --- 545 def p_statement__assign(self, p): 546 "statement : expr ASSIGN expr SEMI" 547 p[0] = ast.AssignStatementAST(self, p[1], p[3]) 548 549 def p_statement__enqueue(self, p): 550 "statement : ENQUEUE '(' var ',' type pairs ')' statements" 551 p[0] = ast.EnqueueStatementAST(self, p[3], p[5], p[6], p[8]) 552 |
553 def p_statement__stall_and_wait(self, p): 554 "statement : STALL_AND_WAIT '(' var ',' var ')' SEMI" 555 p[0] = ast.StallAndWaitStatementAST(self, p[3], p[5]) 556 557 def p_statement__wake_up_dependents(self, p): 558 "statement : WAKE_UP_DEPENDENTS '(' var ')' SEMI" 559 p[0] = ast.WakeUpDependentsStatementAST(self, p[3]) 560 |
|
550 def p_statement__peek(self, p): 551 "statement : PEEK '(' var ',' type pairs ')' statements" 552 p[0] = ast.PeekStatementAST(self, p[3], p[5], p[6], p[8], "peek") 553 554 def p_statement__copy_head(self, p): 555 "statement : COPY_HEAD '(' var ',' var pairs ')' SEMI" 556 p[0] = ast.CopyHeadStatementAST(self, p[3], p[5], p[6]) 557 --- 148 unchanged lines hidden --- | 561 def p_statement__peek(self, p): 562 "statement : PEEK '(' var ',' type pairs ')' statements" 563 p[0] = ast.PeekStatementAST(self, p[3], p[5], p[6], p[8], "peek") 564 565 def p_statement__copy_head(self, p): 566 "statement : COPY_HEAD '(' var ',' var pairs ')' SEMI" 567 p[0] = ast.CopyHeadStatementAST(self, p[3], p[5], p[6]) 568 --- 148 unchanged lines hidden --- |