1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // ADLPARSE.HPP - Definitions for Architecture Description Language Parser
26 // Authors: Chris Vick and Mike Paleczny
27
28 // Class List
29 class Form;
30 // ***** Top Level, 1, classes *****
31 class InstructForm;
32 class OperandForm;
33 class OpClassForm;
34 class AttributeForm;
35 class RegisterForm;
36 class PipelineForm;
37 class SourceForm;
38 class Peephole;
39 // ***** Level 2 classes *****
40 class Component;
41 class Predicate;
42 class MatchRule;
43 class Encode;
44 class Attribute;
260 void skipws_common(bool do_preproc);
261
262 FileBuff &_buf; // File buffer to be parsed
263 ArchDesc &_AD; // Architecture Description being built
264
265 public:
266
267 ADLParser(FileBuff &buf, ArchDesc &archDesc); // Create new ADLParser object
268 ~ADLParser(); // Destroy ADLParser object
269
270 void parse(void); // Do the parsing & build forms lists
271
272 int linenum() { return _buf.linenum(); }
273
274 static bool is_literal_constant(const char *hex_string);
275 static bool is_hex_digit(char digit);
276 static bool is_int_token(const char* token, int& intval);
277 static bool equivalent_expressions(const char* str1, const char* str2);
278 static void trim(char* &token); // trim leading & trailing spaces
279 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_ADLC_ADLPARSE_HPP
26 #define SHARE_VM_ADLC_ADLPARSE_HPP
27
28 // ADLPARSE.HPP - Definitions for Architecture Description Language Parser
29 // Authors: Chris Vick and Mike Paleczny
30
31 // Class List
32 class Form;
33 // ***** Top Level, 1, classes *****
34 class InstructForm;
35 class OperandForm;
36 class OpClassForm;
37 class AttributeForm;
38 class RegisterForm;
39 class PipelineForm;
40 class SourceForm;
41 class Peephole;
42 // ***** Level 2 classes *****
43 class Component;
44 class Predicate;
45 class MatchRule;
46 class Encode;
47 class Attribute;
263 void skipws_common(bool do_preproc);
264
265 FileBuff &_buf; // File buffer to be parsed
266 ArchDesc &_AD; // Architecture Description being built
267
268 public:
269
270 ADLParser(FileBuff &buf, ArchDesc &archDesc); // Create new ADLParser object
271 ~ADLParser(); // Destroy ADLParser object
272
273 void parse(void); // Do the parsing & build forms lists
274
275 int linenum() { return _buf.linenum(); }
276
277 static bool is_literal_constant(const char *hex_string);
278 static bool is_hex_digit(char digit);
279 static bool is_int_token(const char* token, int& intval);
280 static bool equivalent_expressions(const char* str1, const char* str2);
281 static void trim(char* &token); // trim leading & trailing spaces
282 };
283
284 #endif // SHARE_VM_ADLC_ADLPARSE_HPP
|