parser.py (7922:7532067f818e) | parser.py (8086:bf0335d98250) |
---|---|
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 --- 142 unchanged lines hidden (view full) --- 151 'machine' : 'MACHINE', 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', | 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 --- 142 unchanged lines hidden (view full) --- 151 'machine' : 'MACHINE', 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 'state_declaration' : 'STATE_DECL', |
|
159 'peek' : 'PEEK', 160 'stall_and_wait' : 'STALL_AND_WAIT', 161 'wake_up_dependents' : 'WAKE_UP_DEPENDENTS', 162 'wake_up_all_dependents' : 'WAKE_UP_ALL_DEPENDENTS', 163 'enqueue' : 'ENQUEUE', 164 'copy_head' : 'COPY_HEAD', 165 'check_allocate' : 'CHECK_ALLOCATE', 166 'check_stop_slots' : 'CHECK_STOP_SLOTS', --- 157 unchanged lines hidden (view full) --- 324 "decl : STRUCT '(' type pairs ')' '{' type_members '}'" 325 p[0] = ast.TypeDeclAST(self, p[3], p[4], p[7]) 326 327 def p_decl__enum(self, p): 328 "decl : ENUM '(' type pairs ')' '{' type_enums '}'" 329 p[4]["enumeration"] = "yes" 330 p[0] = ast.EnumDeclAST(self, p[3], p[4], p[7]) 331 | 160 'peek' : 'PEEK', 161 'stall_and_wait' : 'STALL_AND_WAIT', 162 'wake_up_dependents' : 'WAKE_UP_DEPENDENTS', 163 'wake_up_all_dependents' : 'WAKE_UP_ALL_DEPENDENTS', 164 'enqueue' : 'ENQUEUE', 165 'copy_head' : 'COPY_HEAD', 166 'check_allocate' : 'CHECK_ALLOCATE', 167 'check_stop_slots' : 'CHECK_STOP_SLOTS', --- 157 unchanged lines hidden (view full) --- 325 "decl : STRUCT '(' type pairs ')' '{' type_members '}'" 326 p[0] = ast.TypeDeclAST(self, p[3], p[4], p[7]) 327 328 def p_decl__enum(self, p): 329 "decl : ENUM '(' type pairs ')' '{' type_enums '}'" 330 p[4]["enumeration"] = "yes" 331 p[0] = ast.EnumDeclAST(self, p[3], p[4], p[7]) 332 |
333 def p_decl__state_decl(self, p): 334 "decl : STATE_DECL '(' type pairs ')' '{' type_states '}'" 335 p[4]["enumeration"] = "yes" 336 p[4]["state_decl"] = "yes" 337 p[0] = ast.StateDeclAST(self, p[3], p[4], p[7]) 338 |
|
332 def p_decl__object(self, p): 333 "decl : type ident pairs SEMI" 334 p[0] = ast.ObjDeclAST(self, p[1], p[2], p[3]) 335 336 def p_decl__func_decl(self, p): 337 """decl : void ident '(' params ')' pairs SEMI 338 | type ident '(' params ')' pairs SEMI""" 339 p[0] = ast.FuncDeclAST(self, p[1], p[2], p[4], p[6], None) --- 42 unchanged lines hidden (view full) --- 382 def p_type_enums__empty(self, p): 383 "type_enums : empty" 384 p[0] = [] 385 386 def p_type_enum(self, p): 387 "type_enum : ident pairs SEMI" 388 p[0] = ast.TypeFieldEnumAST(self, p[1], p[2]) 389 | 339 def p_decl__object(self, p): 340 "decl : type ident pairs SEMI" 341 p[0] = ast.ObjDeclAST(self, p[1], p[2], p[3]) 342 343 def p_decl__func_decl(self, p): 344 """decl : void ident '(' params ')' pairs SEMI 345 | type ident '(' params ')' pairs SEMI""" 346 p[0] = ast.FuncDeclAST(self, p[1], p[2], p[4], p[6], None) --- 42 unchanged lines hidden (view full) --- 389 def p_type_enums__empty(self, p): 390 "type_enums : empty" 391 p[0] = [] 392 393 def p_type_enum(self, p): 394 "type_enum : ident pairs SEMI" 395 p[0] = ast.TypeFieldEnumAST(self, p[1], p[2]) 396 |
397 # States 398 def p_type_states__list(self, p): 399 "type_states : type_state type_states" 400 p[0] = [ p[1] ] + p[2] 401 402 def p_type_states__empty(self, p): 403 "type_states : empty" 404 p[0] = [] 405 406 def p_type_state(self, p): 407 "type_state : ident ',' enumeration pairs SEMI" 408 p[0] = ast.TypeFieldStateAST(self, p[1], p[3], p[4]) 409 |
|
390 # Type 391 def p_types__multiple(self, p): 392 "types : type ',' types" 393 p[0] = [ p[1] ] + p[3] 394 395 def p_types__one(self, p): 396 "types : type" 397 p[0] = [ p[1] ] --- 347 unchanged lines hidden --- | 410 # Type 411 def p_types__multiple(self, p): 412 "types : type ',' types" 413 p[0] = [ p[1] ] + p[3] 414 415 def p_types__one(self, p): 416 "types : type" 417 p[0] = [ p[1] ] --- 347 unchanged lines hidden --- |