1 /* program.c++ -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2009 */
2 
3 /*
4 
5 Copyright (c) 2005-2009 Made to Order Software Corp.
6 
7 Permission is hereby granted, free of charge, to any
8 person obtaining a copy of this software and
9 associated documentation files (the "Software"), to
10 deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify,
12 merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom
14 the Software is furnished to do so, subject to the
15 following conditions:
16 
17 The above copyright notice and this permission notice
18 shall be included in all copies or substantial
19 portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
22 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
23 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
24 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
25 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 SOFTWARE.
31 
32 */
33 
34 #include	"parser.h"
35 
36 
37 namespace sswf
38 {
39 namespace as
40 {
41 
42 
43 /**********************************************************************/
44 /**********************************************************************/
45 /***  PARSER PROGRAM  *************************************************/
46 /**********************************************************************/
47 /**********************************************************************/
48 
Program(NodePtr & node)49 void IntParser::Program(NodePtr& node)
50 {
51 	node.CreateNode(NODE_PROGRAM);
52 	node.SetInputInfo(f_lexer.GetInput());
53 	while(f_data.f_type != NODE_EOF) {
54 		NodePtr directive_list;
55 		DirectiveList(directive_list);
56 		node.AddChild(directive_list);
57 
58 		if(f_data.f_type == NODE_ELSE) {
59 			f_lexer.ErrMsg(AS_ERR_INVALID_KEYWORD, "'else' not expected without an 'if' keyword");
60 			GetToken();
61 		}
62 		else if(f_data.f_type == '}') {
63 			f_lexer.ErrMsg(AS_ERR_CURVLY_BRAKETS_EXPECTED, "'}' not expected without a '{'");
64 			GetToken();
65 		}
66 	}
67 }
68 
69 
70 
71 
72 
73 };	// namespace as
74 };	// namespace sswf
75