Deleted Added
sdiff udiff text old ( 6907:b05de761960e ) new ( 6999:f226c098c393 )
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

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

25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Nathan Binkert
28
29import os.path
30import re
31import sys
32
33from m5.util.grammar import Grammar, TokenError, ParseError
34
35import slicc.ast as ast
36import slicc.util as util
37from slicc.symbols import SymbolTable
38
39def read_slicc(sources):
40 if not isinstance(sources, (list,tuple)):

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

45 sm_file = sm_file.strip()
46 if not sm_file:
47 continue
48 if sm_file.startswith("#"):
49 continue
50 yield sm_file
51
52class SLICC(Grammar):
53 def __init__(self, **kwargs):
54 super(SLICC, self).__init__(**kwargs)
55 self.decl_list_vec = []
56 self.current_file = None
57 self.symtab = SymbolTable()
58
59 def parse(self, filename):
60 self.current_file = filename
61 f = file(filename, 'r')
62 text = f.read()
63 try:
64 decl_list = super(SLICC, self).parse(text)
65 except (TokenError, ParseError), e:
66 sys.exit("%s: %s:%d" % (e, filename, e.token.lineno))

--- 624 unchanged lines hidden ---