Beispiel #1
0
        public void VerifyDefaultState()
        {
            StateSymbol state = _globals.Resolve("default(*)") as StateSymbol;

            if (state == null)
            {
                _listener.Error(
                    "line: 0:0" + " No default state defined"
                    );
            }
        }
Beispiel #2
0
        public void Define(StateSymbol stateSym, IScope currentScope)
        {
            if (stateSym.Name != "default(*)" && _globals.Resolve("default(*)") == null)
            {
                _listener.Error(
                    "line " + stateSym.Def.Line + ":" + stateSym.Def.CharPositionInLine + " State '"
                    + stateSym.Name + "' cannot be defined yet. Default state must be defined first."
                    );
            }

            this.Define((Symbol)stateSym, currentScope);
        }
Beispiel #3
0
        public void CheckStateChange(LSLAst chgNode, LSLAst destID)
        {
            string      stateName = destID != null ? destID.Text + "(*)" : "default(*)";
            StateSymbol state     = _globals.Resolve(stateName) as StateSymbol;

            if (state == null)
            {
                _listener.Error(
                    "line " + chgNode.Token.Line + ":" + chgNode.Token.CharPositionInLine +
                    " Undefined state " + stateName
                    );
            }
        }
Beispiel #4
0
	private void stateBlockDef()
	{
		EnterRule_stateBlockDef();
		EnterRule("stateBlockDef", 11);
		TraceIn("stateBlockDef", 11);
		LSLAst ident = default(LSLAst);

		try { DebugEnterRule(GrammarFileName, "stateBlockDef");
		DebugLocation(141, 1);
		try
		{
			// Def.g:142:2: ( ^( STATE_DEF ident= . ( . )* ) )
			DebugEnterAlt(1);
			// Def.g:142:4: ^( STATE_DEF ident= . ( . )* )
			{
			DebugLocation(142, 4);
			DebugLocation(142, 6);
			Match(input,STATE_DEF,Follow._STATE_DEF_in_stateBlockDef307); if (state.failed) return;

			Match(input, TokenTypes.Down, null); if (state.failed) return;
			DebugLocation(142, 21);
			ident=(LSLAst)input.LT(1);
			MatchAny(input); if (state.failed) return;
			DebugLocation(142, 24);
			// Def.g:142:24: ( . )*
			try { DebugEnterSubRule(7);
			while (true)
			{
				int alt7=2;
				try { DebugEnterDecision(7, false);
				int LA7_0 = input.LA(1);

				if (((LA7_0>=ASSIGN_EQ && LA7_0<=95)))
				{
					alt7 = 1;
				}
				else if ((LA7_0==UP))
				{
					alt7 = 2;
				}


				} finally { DebugExitDecision(7); }
				switch ( alt7 )
				{
				case 1:
					DebugEnterAlt(1);
					// Def.g:142:24: .
					{
					DebugLocation(142, 24);
					MatchAny(input); if (state.failed) return;

					}
					break;

				default:
					goto loop7;
				}
			}

			loop7:
				;

			} finally { DebugExitSubRule(7); }


			Match(input, TokenTypes.Up, null); if (state.failed) return;
			DebugLocation(143, 3);
			if (state.backtracking == 1)
			{

							StateSymbol stateSym = new StateSymbol(ident.Text, currentScope);
							stateSym.Def = ident;            // track AST location of def's ID
						        ident.symbol = stateSym;         // track in AST
						        symtab.Define(stateSym, currentScope);
						        
						        currentScope = stateSym;
						
			}

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("stateBlockDef", 11);
			LeaveRule("stateBlockDef", 11);
			LeaveRule_stateBlockDef();
		}
		DebugLocation(151, 1);
		} finally { DebugExitRule(GrammarFileName, "stateBlockDef"); }
		return;

	}
Beispiel #5
0
        public void Define(StateSymbol stateSym, IScope currentScope)
        {
            if (stateSym.Name != "default(*)" && _globals.Resolve("default(*)") == null)
            {
                _listener.Error(
                    "line " + stateSym.Def.Line + ":" + stateSym.Def.CharPositionInLine + " State '"
                        + stateSym.Name + "' cannot be defined yet. Default state must be defined first."
                 );
            }

            this.Define((Symbol)stateSym, currentScope);
        }