Deleted Added
sdiff udiff text old ( 10307:6df951dcd7d9 ) new ( 10308:8c0870dbae5c )
full compact
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

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

253 dirname = os.path.dirname(self.current_source)
254 if os.path.exists(os.path.join(dirname, p[2])):
255 filename = os.path.join(dirname, p[2])
256 else:
257 filename = os.path.join(self.base_dir, p[2])
258 p[0] = self.parse_file(filename)
259
260 def p_decl__machine0(self, p):
261 "decl : MACHINE '(' idents ')' ':' params '{' decls '}'"
262 p[0] = ast.MachineAST(self, p[3], [], p[7], p[9])
263
264 def p_decl__machine1(self, p):
265 "decl : MACHINE '(' idents pairs ')' ':' params '{' decls '}'"
266 p[0] = ast.MachineAST(self, p[3], p[4], p[7], p[9])
267
268 def p_decl__action(self, p):
269 "decl : ACTION '(' ident pairs ')' statements"
270 p[0] = ast.ActionDeclAST(self, p[3], p[4], p[6])
271
272 def p_decl__in_port(self, p):
273 "decl : IN_PORT '(' ident ',' type ',' var pairs ')' statements"

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

314
315 def p_decl__state_decl(self, p):
316 "decl : STATE_DECL '(' type pairs ')' '{' type_states '}'"
317 p[4]["enumeration"] = "yes"
318 p[4]["state_decl"] = "yes"
319 p[0] = ast.StateDeclAST(self, p[3], p[4], p[7])
320
321 # Type fields
322 def p_type_members__list(self, p):
323 "type_members : type_member type_members"
324 p[0] = [ p[1] ] + p[2]
325
326 def p_type_members__empty(self, p):
327 "type_members : empty"
328 p[0] = []
329

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

335
336 # Member / Variable declarations
337 def p_decl__obj_decl(self, p):
338 "decl : obj_decl"
339 p[0] = p[1]
340
341 def p_obj_decl__0(self, p):
342 "obj_decl : type ident pairs SEMI"
343 p[0] = ast.ObjDeclAST(self, p[1], p[2], p[3], None)
344
345 def p_obj_decl__1(self, p):
346 "obj_decl : type STAR ident pairs SEMI"
347 p[0] = ast.ObjDeclAST(self, p[1], p[3], p[4], None)
348
349 def p_obj_decl__2(self, p):
350 "obj_decl : type ident ASSIGN expr SEMI"
351 p[0] = ast.ObjDeclAST(self, p[1], p[2], ast.PairListAST(self), p[4])
352
353 def p_obj_decl__3(self, p):
354 "obj_decl : type STAR ident ASSIGN expr SEMI"
355 p[0] = ast.ObjDeclAST(self, p[1], p[3], ast.PairListAST(self), p[5])
356
357 # Function definition and declaration
358 def p_decl__func_decl(self, p):
359 "decl : func_decl"
360 p[0] = p[1]
361
362 def p_func_decl__0(self, p):
363 """func_decl : void ident '(' params ')' pairs SEMI

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

421 "param : type ident"
422 p[0] = ast.FormalParamAST(self, p[1], p[2])
423
424 def p_param__pointer(self, p):
425 "param : type STAR ident"
426 p[0] = ast.FormalParamAST(self, p[1], p[3], None, True)
427
428 def p_param__pointer_default(self, p):
429 "param : type STAR ident '=' STRING"
430 p[0] = ast.FormalParamAST(self, p[1], p[3], p[5], True)
431
432 def p_param__default_number(self, p):
433 "param : type ident '=' NUMBER"
434 p[0] = ast.FormalParamAST(self, p[1], p[2], p[4])
435
436 def p_param__default_bool(self, p):
437 "param : type ident '=' LIT_BOOL"
438 p[0] = ast.FormalParamAST(self, p[1], p[2], p[4])
439
440 def p_param__default_string(self, p):
441 "param : type ident '=' STRING"
442 p[0] = ast.FormalParamAST(self, p[1], p[2], p[4])
443
444 # Type
445 def p_types__multiple(self, p):
446 "types : type ',' types"
447 p[0] = [ p[1] ] + p[3]
448
449 def p_types__one(self, p):

--- 276 unchanged lines hidden ---