private static StateMachine?ReflectSM(IParseQueue q) { string method = q.Scan(); if (method == "file") { q.Advance(); return(StateMachineManager.FromName(q.Next())); } else if (method == "null") { q.Advance(); return(null); } else if (method == "stall") { q.Advance(); return(WaitForPhaseSM); } else { var line = q.GetLastLine(); try { return(StateMachine.Create(q)); } catch (Exception ex) { throw new SMException($"Nested StateMachine construction starting on line {line} failed.", ex); } } }
public ReflCtx(IParseQueue q) { List <ParsingProperty> properties = new List <ParsingProperty>(); props = new ParsingProperties(new ParsingProperty[0]); while (q.MaybeScan() == SMParser.PROP2_KW) { q.Advance(); properties.Add(q.NextChild().Into <ParsingProperty>()); if (!q.IsNewline) { throw new Exception( $"Line {q.GetLastLine()} is missing a newline at the end of the the property declaration. Instead, it found \"{q.Scan()}\"."); } } props = new ParsingProperties(properties); }