adding Parse_Data record definition
This commit is contained in:
		@ -185,16 +185,16 @@ package body H3.Compilers is
 | 
				
			|||||||
	end Pop_Inclusion;
 | 
						end Pop_Inclusion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	-- -------------------------------------------------------------------
 | 
						-- -------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	procedure Parse_Ident (C: in out Compiler) is
 | 
						procedure Parse_Ident (C: in out Compiler) is
 | 
				
			||||||
	begin
 | 
						begin
 | 
				
			||||||
		if C.Tk.Buf.Equals(LB_CLASS) then
 | 
							if C.Tk.Buf.Equals(LB_CLASS) then
 | 
				
			||||||
			null;
 | 
					 | 
				
			||||||
			Push_Parse_State (C, PS_CLASS_1);
 | 
								Push_Parse_State (C, PS_CLASS_1);
 | 
				
			||||||
		elsif C.Tk.Buf.Equals(LB_FUN) then
 | 
							elsif C.Tk.Buf.Equals(LB_FUN) then
 | 
				
			||||||
			null;
 | 
								Push_Parse_State (C, PS_FUN_1);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			-- probably a command name or a variable name?
 | 
								-- probably a command name or a variable name?
 | 
				
			||||||
			null;
 | 
								Push_Parse_State (C, PS_PLAIN_STATEMENT_START);
 | 
				
			||||||
		end if;
 | 
							end if;
 | 
				
			||||||
 	end Parse_Ident;
 | 
					 	end Parse_Ident;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -208,6 +208,11 @@ package body H3.Compilers is
 | 
				
			|||||||
		null;
 | 
							null;
 | 
				
			||||||
	end Parse_Class_2;
 | 
						end Parse_Class_2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						-- -------------------------------------------------------------------
 | 
				
			||||||
 | 
						procedure Parse_Plain_Statement_Start (C: in out Compiler) is
 | 
				
			||||||
 | 
						begin
 | 
				
			||||||
 | 
							null;
 | 
				
			||||||
 | 
						end Parse_Plain_Statement_Start;
 | 
				
			||||||
	-- -------------------------------------------------------------------
 | 
						-- -------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	procedure Parse_Start (C: in out Compiler) is
 | 
						procedure Parse_Start (C: in out Compiler) is
 | 
				
			||||||
@ -292,10 +297,15 @@ package body H3.Compilers is
 | 
				
			|||||||
		case C.Prs.States(C.Prs.Top).Current is
 | 
							case C.Prs.States(C.Prs.Top).Current is
 | 
				
			||||||
			when PS_START =>
 | 
								when PS_START =>
 | 
				
			||||||
				Parse_Start (C);
 | 
									Parse_Start (C);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			when PS_INCLUDE_TARGET =>
 | 
								when PS_INCLUDE_TARGET =>
 | 
				
			||||||
				Parse_Include_Target (C);
 | 
									Parse_Include_Target (C);
 | 
				
			||||||
			when PS_INCLUDE_TERMINATOR =>
 | 
								when PS_INCLUDE_TERMINATOR =>
 | 
				
			||||||
				Parse_Include_Terminator (C);
 | 
									Parse_Include_Terminator (C);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								when PS_PLAIN_STATEMENT_START =>
 | 
				
			||||||
 | 
									Parse_Plain_Statement_Start (C);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			when others =>
 | 
								when others =>
 | 
				
			||||||
				raise Syntax_Error with "unknown parser state"; -- TODO: change this...
 | 
									raise Syntax_Error with "unknown parser state"; -- TODO: change this...
 | 
				
			||||||
		end case;
 | 
							end case;
 | 
				
			||||||
 | 
				
			|||||||
@ -94,11 +94,34 @@ private
 | 
				
			|||||||
		PS_INCLUDE_TERMINATOR,
 | 
							PS_INCLUDE_TERMINATOR,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		PS_CLASS_1,
 | 
							PS_CLASS_1,
 | 
				
			||||||
		PS_CLASS_2
 | 
							PS_CLASS_2,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							PS_FUN_1,
 | 
				
			||||||
 | 
							PS_FUN_2,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							PS_PLAIN_STATEMENT_START
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						type Parse_Data_Code is (
 | 
				
			||||||
 | 
							PD_VOID,
 | 
				
			||||||
 | 
							PD_STATEMENT,
 | 
				
			||||||
 | 
							PD_ASSIGNMENT
 | 
				
			||||||
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						type Parse_Data(Code: Parse_Data_Code := PD_VOID) is record
 | 
				
			||||||
 | 
							case Code is
 | 
				
			||||||
 | 
								when PD_VOID =>
 | 
				
			||||||
 | 
									null;
 | 
				
			||||||
 | 
								when PD_STATEMENT =>
 | 
				
			||||||
 | 
									Cmd_Name: S.Elastic_String;
 | 
				
			||||||
 | 
								when PD_ASSIGNMENT =>
 | 
				
			||||||
 | 
									Var_Name: S.Elastic_String;
 | 
				
			||||||
 | 
							end case;
 | 
				
			||||||
 | 
						end record;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	type Parse_State is record
 | 
						type Parse_State is record
 | 
				
			||||||
		Current: Parse_State_Code := PS_START;
 | 
							Current: Parse_State_Code := PS_START;
 | 
				
			||||||
 | 
							Data: Parse_Data;
 | 
				
			||||||
	end record;
 | 
						end record;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	type Parse_State_Array is array(System_Index range<>) of Parse_State;
 | 
						type Parse_State_Array is array(System_Index range<>) of Parse_State;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user