parser.py (10085:b9891fbae4c8) parser.py (10155:3b0bcc8c34ca)
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

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

552 "statement : expr SEMI"
553 p[0] = ast.ExprStatementAST(self, p[1])
554
555 def p_statement__assign(self, p):
556 "statement : expr ASSIGN expr SEMI"
557 p[0] = ast.AssignStatementAST(self, p[1], p[3])
558
559 def p_statement__enqueue(self, p):
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

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

552 "statement : expr SEMI"
553 p[0] = ast.ExprStatementAST(self, p[1])
554
555 def p_statement__assign(self, p):
556 "statement : expr ASSIGN expr SEMI"
557 p[0] = ast.AssignStatementAST(self, p[1], p[3])
558
559 def p_statement__enqueue(self, p):
560 "statement : ENQUEUE '(' var ',' type pairs ')' statements"
561 p[0] = ast.EnqueueStatementAST(self, p[3], p[5], p[6], p[8])
560 "statement : ENQUEUE '(' var ',' type ')' statements"
561 p[0] = ast.EnqueueStatementAST(self, p[3], p[5], None, p[7])
562
562
563 def p_statement__enqueue_latency(self, p):
564 "statement : ENQUEUE '(' var ',' type ',' expr ')' statements"
565 p[0] = ast.EnqueueStatementAST(self, p[3], p[5], p[7], p[9])
566
563 def p_statement__stall_and_wait(self, p):
564 "statement : STALL_AND_WAIT '(' var ',' var ')' SEMI"
565 p[0] = ast.StallAndWaitStatementAST(self, p[3], p[5])
566
567 def p_statement__peek(self, p):
568 "statement : PEEK '(' var ',' type pairs ')' statements"
569 p[0] = ast.PeekStatementAST(self, p[3], p[5], p[6], p[8], "peek")
570
571 def p_statement__check_allocate(self, p):
572 "statement : CHECK_ALLOCATE '(' var ')' SEMI"
573 p[0] = ast.CheckAllocateStatementAST(self, p[3])
574
575 def p_statement__check_stop(self, p):
576 "statement : CHECK_STOP_SLOTS '(' var ',' STRING ',' STRING ')' SEMI"
577 p[0] = ast.CheckStopStatementAST(self, p[3], p[5], p[7])
578
567 def p_statement__stall_and_wait(self, p):
568 "statement : STALL_AND_WAIT '(' var ',' var ')' SEMI"
569 p[0] = ast.StallAndWaitStatementAST(self, p[3], p[5])
570
571 def p_statement__peek(self, p):
572 "statement : PEEK '(' var ',' type pairs ')' statements"
573 p[0] = ast.PeekStatementAST(self, p[3], p[5], p[6], p[8], "peek")
574
575 def p_statement__check_allocate(self, p):
576 "statement : CHECK_ALLOCATE '(' var ')' SEMI"
577 p[0] = ast.CheckAllocateStatementAST(self, p[3])
578
579 def p_statement__check_stop(self, p):
580 "statement : CHECK_STOP_SLOTS '(' var ',' STRING ',' STRING ')' SEMI"
581 p[0] = ast.CheckStopStatementAST(self, p[3], p[5], p[7])
582
579 def p_statement__static_cast(self, p):
580 "aexpr : STATIC_CAST '(' type ',' expr ')'"
581 p[0] = ast.StaticCastAST(self, p[3], "ref", p[5])
582
583 def p_statement__static_cast_ptr(self, p):
584 "aexpr : STATIC_CAST '(' type ',' STRING ',' expr ')'"
585 p[0] = ast.StaticCastAST(self, p[3], p[5], p[7])
586
587 def p_statement__return(self, p):
588 "statement : RETURN expr SEMI"
589 p[0] = ast.ReturnStatementAST(self, p[2])
590
591 def p_statement__if(self, p):
592 "statement : if_statement"
593 p[0] = p[1]
594

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

600 "if_statement : IF '(' expr ')' statements ELSE statements"
601 p[0] = ast.IfStatementAST(self, p[3], p[5], p[7])
602
603 def p_statement__if_else_if(self, p):
604 "if_statement : IF '(' expr ')' statements ELSE if_statement"
605 p[0] = ast.IfStatementAST(self, p[3], p[5],
606 ast.StatementListAST(self, p[7]))
607
583 def p_statement__return(self, p):
584 "statement : RETURN expr SEMI"
585 p[0] = ast.ReturnStatementAST(self, p[2])
586
587 def p_statement__if(self, p):
588 "statement : if_statement"
589 p[0] = p[1]
590

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

596 "if_statement : IF '(' expr ')' statements ELSE statements"
597 p[0] = ast.IfStatementAST(self, p[3], p[5], p[7])
598
599 def p_statement__if_else_if(self, p):
600 "if_statement : IF '(' expr ')' statements ELSE if_statement"
601 p[0] = ast.IfStatementAST(self, p[3], p[5],
602 ast.StatementListAST(self, p[7]))
603
604 def p_expr__static_cast(self, p):
605 "aexpr : STATIC_CAST '(' type ',' expr ')'"
606 p[0] = ast.StaticCastAST(self, p[3], "ref", p[5])
607
608 def p_expr__static_cast_ptr(self, p):
609 "aexpr : STATIC_CAST '(' type ',' STRING ',' expr ')'"
610 p[0] = ast.StaticCastAST(self, p[3], p[5], p[7])
611
608 def p_expr__var(self, p):
609 "aexpr : var"
610 p[0] = p[1]
611
612 def p_expr__localvar(self, p):
613 "aexpr : type ident"
614 p[0] = ast.LocalVariableAST(self, p[1], p[2])
615

--- 100 unchanged lines hidden ---
612 def p_expr__var(self, p):
613 "aexpr : var"
614 p[0] = p[1]
615
616 def p_expr__localvar(self, p):
617 "aexpr : type ident"
618 p[0] = ast.LocalVariableAST(self, p[1], p[2])
619

--- 100 unchanged lines hidden ---