parser.py (11282:afdcebd314be) parser.py (11283:4cc8b312f026)
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

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

57 no_warning=not self.verbose)
58
59 def codeFormatter(self, *args, **kwargs):
60 code = code_formatter(*args, **kwargs)
61 code['protocol'] = self.protocol
62 return code
63
64 def process(self):
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

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

57 no_warning=not self.verbose)
58
59 def codeFormatter(self, *args, **kwargs):
60 code = code_formatter(*args, **kwargs)
61 code['protocol'] = self.protocol
62 return code
63
64 def process(self):
65 self.decl_list.findMachines()
66 self.decl_list.generate()
67
68 def writeCodeFiles(self, code_path, includes):
69 self.symtab.writeCodeFiles(code_path, includes)
70
71 def writeHTMLFiles(self, html_path):
72 self.symtab.writeHTMLFiles(html_path)
73
74 def files(self):
65 self.decl_list.generate()
66
67 def writeCodeFiles(self, code_path, includes):
68 self.symtab.writeCodeFiles(code_path, includes)
69
70 def writeHTMLFiles(self, html_path):
71 self.symtab.writeHTMLFiles(html_path)
72
73 def files(self):
75 f = set([
76 'MachineType.cc',
77 'MachineType.hh',
78 'Types.hh' ])
74 f = set(['Types.hh'])
79
80 f |= self.decl_list.files()
81
82 return f
83
84 t_ignore = '\t '
85
86 # C or C++ comment (ignore)

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

254 dirname = os.path.dirname(self.current_source)
255 if os.path.exists(os.path.join(dirname, p[2])):
256 filename = os.path.join(dirname, p[2])
257 else:
258 filename = os.path.join(self.base_dir, p[2])
259 p[0] = self.parse_file(filename)
260
261 def p_decl__machine0(self, p):
75
76 f |= self.decl_list.files()
77
78 return f
79
80 t_ignore = '\t '
81
82 # C or C++ comment (ignore)

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

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

--- 474 unchanged lines hidden ---
263 p[0] = ast.MachineAST(self, p[3], p[4], p[7], p[9])
264
265 def p_decl__action(self, p):
266 "decl : ACTION '(' ident pairs ')' statements"
267 p[0] = ast.ActionDeclAST(self, p[3], p[4], p[6])
268
269 def p_decl__in_port(self, p):
270 "decl : IN_PORT '(' ident ',' type ',' var pairs ')' statements"

--- 474 unchanged lines hidden ---