void IHRONEntity2.Apply(SubString name, IScannerVisitor visitor) { if (visitor == null) { return; } visitor.Value_Begin(name); foreach (var line in m_value.ReadLines()) { visitor.Value_Line(line); } visitor.Value_End(); }
public void Value_Line(SubString value) { m_sb.Remove(0, m_sb.Length); m_sb.Append('\t', m_indent); m_sb.AppendSubString(value); WriteLine(m_sb); }
protected override Completion ExecuteImpl(ExecutionEnvironment enviroment) { if (String == null) { return(Completion.Exception(Language.NullException, this)); } var c = String.Execute(enviroment); if (!c.IsValue) { return(c); } if (!(c.ReturnValue is string)) { return(Completion.Exception(Language.NotStringException, String)); } if (SubString == null) { return(Completion.Exception(Language.NotStringException, this)); } var f = SubString.Execute(enviroment); if (!f.IsValue) { return(f); } if (!(f.ReturnValue is string)) { return(Completion.Exception(Language.NotStringException, SubString)); } return(new Completion((c.ReturnValue as string).LastIndexOf(f.ReturnValue as string))); }
internal void ToHtml(ref Response response, ref SubString value) { if (value.Length != 0) { fixed(char *valueFixed = value.String) ToHtml(ref response, valueFixed + value.Start, value.Length); } }
public void PreProcessor(SubString line) { m_sb.Remove(0, m_sb.Length); m_sb.Append('!'); m_sb.AppendSubString(line); WriteLine(m_sb); }
public LeftArray <KeyValue <int, int> > LeftRightMatchs(SubString text) { LeftArray <KeyValue <int, int> > matchs = default(LeftArray <KeyValue <int, int> >); LeftRightMatchs(ref text, ref matchs); return(matchs); }
internal CExoLocString(BinaryReader br, int offset) : base(GffFieldType.CExoLocString) { //Header Info br.BaseStream.Seek(24, 0); int LabelOffset = br.ReadInt32(); int LabelCount = br.ReadInt32(); int FieldDataOffset = br.ReadInt32(); //Basic Field Data br.BaseStream.Seek(offset, 0); Type = (GffFieldType)br.ReadInt32(); int LabelIndex = br.ReadInt32(); int DataOrDataOffset = br.ReadInt32(); //Label Logic br.BaseStream.Seek(LabelOffset + LabelIndex * 16, 0); Label = new string(br.ReadChars(16)).TrimEnd('\0'); //Comlex Value Logic br.BaseStream.Seek(FieldDataOffset + DataOrDataOffset, 0); int TotalSize = br.ReadInt32(); StringRef = br.ReadInt32(); int StringCount = br.ReadInt32(); for (int i = 0; i < StringCount; i++) { SubString SS = new SubString(); SS.StringID = br.ReadInt32(); int StringLength = br.ReadInt32(); SS.SString = new string(br.ReadChars(StringLength)); Strings.Add(SS); } }
/// <summary> /// 判断连接地址是否以 http:// 或者 https:// 或者 // 开头 /// </summary> /// <param name="url"></param> /// <returns></returns> private unsafe static bool isHttpOrDefalut(SubString url) { if (url.Length > 7 && url[6] == '/') { fixed(char *urlFixed = url.GetFixedBuffer()) { char *start = urlFixed + url.Start; if ((*(int *)start | 0x200020) == 'h' + ('t' << 16) && (*(int *)(start + 2) | 0x200020) == 't' + ('p' << 16)) { if (*(int *)(start + 4) == ':' + ('/' << 16)) { return(true); } else if ((*(int *)(start + 4) | 0x20) == 's' + (':' << 16) && start[7] == '/') { return(true); } } } } if (url.Length > 2) { return(url[0] == '/' && url[1] == '/'); } return(false); }
public bool TryFormat(ref StringReader reader, StringBuilder output, FormatterParams formatterParams) { reader.SkipSpaces(); SubString subString = reader.ReadWord(); if (subString.length == 0) { return(false); } reader.SkipSpaces(); if (reader.Read(',')) { reader.SkipSpaces(); if (reader.Read("select")) { reader.SkipSpaces(); if (reader.Read(',')) { string value = formatterParams.valueProvider.GetValue(subString.ToString()); FormatSelect(value, reader, output, formatterParams); return(true); } } } return(false); }
public static KeyValue <ParseResult, Node> toJsonNode <valueType>(this SubString json, ParseConfig config = null) { KeyValue <ParseResult, Node> value = default(KeyValue <ParseResult, Node>); value.Key = Parser.Parse(ref json, ref value.Value, config); return(value); }
/// <summary> /// 搜索结果项 /// </summary> /// <param name="dataKey">搜索数据关键字</param> internal SearchItem(DataKey dataKey) { DataKey = dataKey; switch (dataKey.Type) { case DataType.HtmlTitle: Html = Html.Cache[dataKey.Id]; MatchText = default(SubString); Indexs = Searcher.DefaultThreadParameter.GetResultIndexs(ref dataKey, Html.Title.Length); break; case DataType.HtmlBodyText: MatchText = (Html = Html.Cache[dataKey.Id]).Text; Indexs = Searcher.DefaultThreadParameter.FormatTextIndexs(ref dataKey, ref MatchText, maxTextLength); break; case DataType.HtmlImage: HtmlImage image = HtmlImage.Cache[dataKey.Id]; Html = Html.Cache[image.HtmlId]; MatchText = image.Title; Indexs = Searcher.DefaultThreadParameter.GetResultIndexs(ref dataKey, MatchText.Count); break; default: Html = null; MatchText = default(SubString); Indexs = null; break; } }
public static KeyValue <DeSerializeResult, Node> toJsonNode <T>(this SubString json, DeSerializeConfig config = null) { KeyValue <DeSerializeResult, Node> value = default(KeyValue <DeSerializeResult, Node>); value.Key = JsonDeSerializer.DeSerialize(ref json, ref value.Value, config); return(value); }
private static KeywordCondition GetCondition(SubString attributes) { KeywordCondition keywordCondition = (KeywordCondition)0; attributes.Trim(); StringReader stringReader = new StringReader(attributes); while (stringReader.hasNext) { if (stringReader.NextEquals("transfer")) { stringReader.position += "transfer".Length; keywordCondition |= KeywordCondition.Transfer; } else if (stringReader.NextEquals("deckbuild")) { stringReader.position += "deckbuild".Length; keywordCondition |= KeywordCondition.EditDeck; } else { stringReader.position++; } } return(keywordCondition); }
///// <summary> ///// 字符查找 ///// </summary> ///// <param name="start">起始位置,不能为null</param> ///// <param name="end">结束位置,不能为null,长度必须大于0</param> ///// <param name="value">查找值</param> ///// <returns>字符位置,失败为null</returns> //internal static char* FindLastNotNull(char* start, char* end, char value) //{ // if (*start == value) // { // while (*--end != value); // return end; // } // ++start; // while (start != end) // { // if (*--end == value) return end; // } // return null; //} /// <summary> /// 比较字符串(忽略大小写) /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> internal static bool EqualCase(this SubString left, ref SubString right) { if (left.Length == right.Length) { if (left.Length != 0) { if (object.ReferenceEquals(left.String, right.String)) { if (left.Start == right.Start) return(true); fixed(char *leftFixed = left.String) { return(AutoCSer.Extension.StringExtension.equalCaseNotNull(leftFixed + left.Start, leftFixed + right.Start, left.Length)); } } fixed(char *leftFixed = left.String, rightFixed = right.String) { return(AutoCSer.Extension.StringExtension.equalCaseNotNull(leftFixed + left.Start, rightFixed + right.Start, left.Length)); } } return(right.String == null ? left.String == null : left.String != null); } return(false); }
public void Write(ref SubString value) { if (value.Length != 0) { WriteNotEmpty(ref value); } }
public LeftArray <KeyValue <int, int> > LeftRightMatchs(ref SubString text) { LeftArray <KeyValue <int, int> > matchs = new LeftArray <KeyValue <int, int> >(0); LeftRightMatchs(ref text, ref matchs); return(matchs); }
/// <summary> /// 搜索结果项 /// </summary> /// <param name="dataKey">搜索数据关键字</param> /// <param name="results">搜索结果</param> internal SearchItem(DataKey dataKey, LeftArray <KeyValue <HashString, AutoCSer.Search.StaticSearcher <DataKey> .QueryResult> > results) { DataKey = dataKey; switch (dataKey.Type) { case DataType.HtmlTitle: Html = Html.Cache[dataKey.Id]; MatchText = default(SubString); Indexs = Searcher.Default.GetResultIndexs(ref dataKey, Html.Title.Length, ref results); break; case DataType.HtmlBodyText: MatchText = (Html = Html.Cache[dataKey.Id]).Text; Indexs = Searcher.Default.FormatTextIndexs(ref dataKey, ref MatchText, ref results, maxTextLength); break; case DataType.HtmlImage: HtmlImage image = HtmlImage.Cache[dataKey.Id]; Html = Html.Cache[image.HtmlId]; MatchText = image.Title; Indexs = Searcher.Default.GetResultIndexs(ref dataKey, MatchText.Count, ref results); break; default: Html = null; MatchText = default(SubString); Indexs = null; break; } }
public IEnumerator <ITask> SubStringHandler(SubString subString) { subString.ResponsePort.Post( SubStringResponse.FromRequest(subString.Body) ); yield break; }
object?IRuleOutput.ComputeOutput(SubString text, Lazy <object?> lazyDefaultOutput) { var parameterOutputs = from p in _parameters select p.ComputeOutput(text, lazyDefaultOutput); return(_function.Invoke(ImmutableList <object?> .Empty.AddRange(parameterOutputs))); }
/// <summary> /// 搜索结果项 /// </summary> /// <param name="word">分词</param> /// <param name="result">索引结果</param> internal SearchItem(SubString word, KeyValuePair <DataKey, AutoCSer.Search.ResultIndexArray> result) { DataKey = result.Key; switch (DataKey.Type) { case DataType.HtmlTitle: Html = Html.Cache[DataKey.Id]; MatchText = default(SubString); Indexs = result.Value.Indexs.getArray(index => new KeyValue <int, int>(index, word.Count)); break; case DataType.HtmlBodyText: MatchText = (Html = Html.Cache[DataKey.Id]).Text; Indexs = Searcher.Default.FormatTextIndexs(ref MatchText, result.Value.Indexs, word.Count, maxTextLength); break; case DataType.HtmlImage: HtmlImage image = HtmlImage.Cache[DataKey.Id]; Html = Html.Cache[image.HtmlId]; MatchText = image.Title; Indexs = result.Value.Indexs.getArray(index => new KeyValue <int, int>(index, word.Count)); break; default: Html = null; MatchText = default(SubString); Indexs = null; break; } }
object?IRuleOutput.ComputeOutput(SubString text, Lazy <object?> lazyDefaultOutput) { var outputPairs = (from pair in _outputPairs select new { KeyExtractor = pair.Key, Key = pair.Key.ComputeOutput(text, lazyDefaultOutput), ValueExtractor = pair.Value, Value = pair.Value.ComputeOutput(text, lazyDefaultOutput) }).ToArray(); var firstNullKey = outputPairs.FirstOrDefault( p => !(p.Key is string || p.Key is SubString)); if (firstNullKey != null) { throw new ParsingException( $"Object's key doesn't resolve to a string: {firstNullKey.KeyExtractor}"); } else { var newObjectPairs = from p in outputPairs select KeyValuePair.Create(p.Key.ToString(), p.Value); var dictionary = ImmutableDictionary <string, object> .Empty .AddRange(newObjectPairs); return(dictionary); } }
public bool TryFormat(ref StringReader input, StringBuilder output, FormatterParams formatterParams) { if (input.current != open) { return(false); } StringReader stringReader = input.Copy(); SubString subString = stringReader.ReadContent(open, close); subString.Trim(); int position = stringReader.position; List <IParserRule> rules = m_rules; int count = rules.Count; for (int i = 0; i < count; i++) { StringReader input2 = new StringReader(input.text); input2.position = subString.startIndex; input2.SetLimit(subString.endIndex); if (rules[i].TryFormat(ref input2, output, formatterParams)) { input.position = position; return(true); } } return(false); }
public void Response(ref SubString value) { if (!IsCreateResponse) { throw new InvalidOperationException(); } CallResponse.Write(ref value); }
private IEnumerable <RuleMatch> RecurseMatch( IEnumerable <TaggedRule> rules, // Used only for debugging purposes, to hook on the context ID of the entire sequence int masterContextID, ExplorerContext context, SubString originalText, int totalMatchLength, ImmutableList <(TaggedRule rule, RuleMatch match)> matches)
public void Equal_CallEqualOnSubstr_EqualResult(string str1, string str2, bool result) { K.Value = 10; var substr1 = new SubString(5, str1); var substr2 = new SubString(0, str2); Assert.AreEqual(substr1.Equals(substr2), result); }
public void AppendFormat(SubString text, StringBuilder output, FormatterParams formatterParams) { StringReader reader = new StringReader(text.originalText); reader.position = text.startIndex; reader.SetLimit(text.endIndex); AppendFormat(ref reader, output, formatterParams); }
object?IRuleOutput.ComputeOutput(SubString text, Lazy <object?> lazyDefaultOutput) { var outputs = _outputs .Select(o => o.ComputeOutput(text, lazyDefaultOutput)) .ToImmutableArray(); return(outputs); }
public void Comment(int indent, SubString comment) { m_sb.Remove(0, m_sb.Length); m_sb.Append('\t', indent); m_sb.Append('#'); m_sb.AppendSubString(comment); WriteLine(m_sb); }
public void Comment(int indent, SubString comment) { m_sb.Remove(0, m_sb.Length); m_sb.Append('\t', indent); m_sb.Append('#'); m_sb.AppendSubString(comment); WriteLine(m_sb); }
protected void appendHtml(ref SubString html) { HashString htmlKey = html; if (!Htmls.ContainsKey(htmlKey)) { Htmls.Add(htmlKey, Htmls.Count); } }
public void Value_Begin(SubString name) { if (Top.Value == null) { return; } m_firstLine = true; m_value.Clear(); }
private static void Append(SubString text, StringBuilder output, FormatterParams formatterParams, string value) { text.Trim(); formatterParams.additionnalRules = new IParserRule[1] { new ReplaceNumber(value) }; formatterParams.formatter.AppendFormat(text, output, formatterParams); }
public void Value_Begin(SubString name) { m_valueName = name; m_value.Clear(); m_firstLine = true; }
public abstract void Apply(SubString name, IHRONVisitor visitor);
public void Comment(int indent, SubString comment) { Visitor.Comment(indent, comment.Value); }
public void Error(int lineNo, SubString line, HRONSerializer.ParseError parseError) { Visitor.Error(lineNo, line.Value, parseError.ToString()); ++ErrorCount; }
public void Object_Begin(SubString name) { Visitor.Object_Begin(name.Value); }
public void Value_Begin(SubString name) { Visitor.Value_Begin(name.Value); }
public void Value_Line(SubString value) { Visitor.Value_Line(value.Value); }
public void Value_Line(SubString value) { m_sb.Remove(0, m_sb.Length); m_sb.Append('\t', m_indent); m_sb.AppendSubString(value); WriteLine(m_sb); }
public void Value_End(SubString name) { --m_indent; }
public void Value_Begin(SubString name) { m_sb.Remove(0, m_sb.Length); m_sb.Append('\t', m_indent); m_sb.Append('='); m_sb.Append(name); ++m_indent; WriteLine(m_sb); }
public void PreProcessor(SubString line) { m_sb.Remove(0, m_sb.Length); m_sb.Append('!'); m_sb.AppendSubString(line); WriteLine(m_sb); }
public void Object_End(SubString name) { --m_indent; }
public void Comment(int indent, SubString comment) { }
public void PreProcessor(SubString line) { }
void IHRONEntity2.Apply(SubString name, IScannerVisitor visitor) { if (visitor == null) { return; } visitor.Object_Begin(name); for (var index = 0; index < m_members.Length; index++) { var pair = m_members[index]; var innerName = pair.Name.ToSubString(); pair.Value.Apply(innerName, visitor); } visitor.Object_End(); }
public void Empty(SubString line) { m_sb.Remove(0, m_sb.Length); m_sb.AppendSubString(line); WriteLine(m_sb); }
public void Value_End(SubString name) { Visitor.Value_End(name.Value); }
public void Error(int lineNo, SubString line, HRONSerializer.ParseError parseError) { m_sb.Remove(0, m_sb.Length); m_sb.AppendFormat(Config.DefaultCulture, "# Error at line {0}: {1}", lineNo, parseError); WriteLine(m_sb); }
public void Object_End(SubString name) { Visitor.Object_End(name.Value); }
public void Object_Begin(SubString name) { m_sb.Remove(0, m_sb.Length); m_sb.Append('\t', m_indent); m_sb.Append('@'); m_sb.AppendSubString(name); WriteLine(m_sb); ++m_indent; }
public bool AcceptLine (SubString ss) { Result = ParserResult.Continue; CurrentLine = ss; Partial_BeginLine (); var bs = ss.BaseString; var begin = ss.Begin; var end = ss.End; for (var iter = begin; iter < end; ++iter) { CurrentCharacter = bs[iter]; apply: if (Result != ParserResult.Continue) { break; } switch (State) { case ParserState.Error: switch (CurrentCharacter) { default: Partial_StateTransition__From_Error (); Partial_StateTransition__From_Error__To_Error (); Partial_StateTransition__To_Error (); break; } break; case ParserState.WrongTagError: switch (CurrentCharacter) { default: State = ParserState.Error; Partial_StateTransition__From_WrongTagError (); Partial_StateTransition__From_WrongTagError__To_Error (); Partial_StateTransition__To_Error (); break; } break; case ParserState.NonEmptyTagError: switch (CurrentCharacter) { default: State = ParserState.Error; Partial_StateTransition__From_NonEmptyTagError (); Partial_StateTransition__From_NonEmptyTagError__To_Error (); Partial_StateTransition__To_Error (); break; } break; case ParserState.PreProcessing: switch (CurrentCharacter) { case '!': State = ParserState.PreProcessorTag; Partial_StateTransition__From_PreProcessing (); Partial_StateTransition__From_PreProcessing__To_PreProcessorTag (); Partial_StateTransition__To_PreProcessorTag (); break; default: State = ParserState.Indention; Partial_StateTransition__From_PreProcessing (); Partial_StateTransition__From_PreProcessing__To_Indention (); Partial_StateTransition__To_Indention (); goto apply; break; } break; case ParserState.Indention: switch (CurrentCharacter) { case '\t': Partial_StateTransition__From_Indention (); Partial_StateTransition__From_Indention__To_Indention (); Partial_StateTransition__To_Indention (); break; default: Partial_StateChoice__From_Indention__Choose_TagExpected_NoContentTagExpected_ValueLine_Error (); switch (State) { case ParserState.TagExpected: Partial_StateTransition__From_Indention (); Partial_StateTransition__From_Indention__To_TagExpected (); Partial_StateTransition__To_TagExpected (); break; case ParserState.NoContentTagExpected: Partial_StateTransition__From_Indention (); Partial_StateTransition__From_Indention__To_NoContentTagExpected (); Partial_StateTransition__To_NoContentTagExpected (); break; case ParserState.ValueLine: Partial_StateTransition__From_Indention (); Partial_StateTransition__From_Indention__To_ValueLine (); Partial_StateTransition__To_ValueLine (); break; case ParserState.Error: Partial_StateTransition__From_Indention (); Partial_StateTransition__From_Indention__To_Error (); Partial_StateTransition__To_Error (); break; default: Result = ParserResult.Error; break; } goto apply; break; } break; case ParserState.TagExpected: switch (CurrentCharacter) { case '@': State = ParserState.ObjectTag; Partial_StateTransition__From_TagExpected (); Partial_StateTransition__From_TagExpected__To_ObjectTag (); Partial_StateTransition__To_ObjectTag (); break; case '=': State = ParserState.ValueTag; Partial_StateTransition__From_TagExpected (); Partial_StateTransition__From_TagExpected__To_ValueTag (); Partial_StateTransition__To_ValueTag (); break; case '#': State = ParserState.CommentTag; Partial_StateTransition__From_TagExpected (); Partial_StateTransition__From_TagExpected__To_CommentTag (); Partial_StateTransition__To_CommentTag (); break; case '\t': case ' ': State = ParserState.EmptyTag; Partial_StateTransition__From_TagExpected (); Partial_StateTransition__From_TagExpected__To_EmptyTag (); Partial_StateTransition__To_EmptyTag (); break; default: State = ParserState.WrongTagError; Partial_StateTransition__From_TagExpected (); Partial_StateTransition__From_TagExpected__To_WrongTagError (); Partial_StateTransition__To_WrongTagError (); break; } break; case ParserState.NoContentTagExpected: switch (CurrentCharacter) { case '#': State = ParserState.CommentTag; Partial_StateTransition__From_NoContentTagExpected (); Partial_StateTransition__From_NoContentTagExpected__To_CommentTag (); Partial_StateTransition__To_CommentTag (); break; case '\t': case ' ': State = ParserState.EmptyTag; Partial_StateTransition__From_NoContentTagExpected (); Partial_StateTransition__From_NoContentTagExpected__To_EmptyTag (); Partial_StateTransition__To_EmptyTag (); break; default: State = ParserState.WrongTagError; Partial_StateTransition__From_NoContentTagExpected (); Partial_StateTransition__From_NoContentTagExpected__To_WrongTagError (); Partial_StateTransition__To_WrongTagError (); break; } break; case ParserState.PreProcessorTag: switch (CurrentCharacter) { default: Partial_StateTransition__From_PreProcessorTag (); Partial_StateTransition__From_PreProcessorTag__To_PreProcessorTag (); Partial_StateTransition__To_PreProcessorTag (); break; } break; case ParserState.ObjectTag: switch (CurrentCharacter) { default: Partial_StateTransition__From_ObjectTag (); Partial_StateTransition__From_ObjectTag__To_ObjectTag (); Partial_StateTransition__To_ObjectTag (); break; } break; case ParserState.ValueTag: switch (CurrentCharacter) { default: Partial_StateTransition__From_ValueTag (); Partial_StateTransition__From_ValueTag__To_ValueTag (); Partial_StateTransition__To_ValueTag (); break; } break; case ParserState.EmptyTag: switch (CurrentCharacter) { case '\t': case ' ': Partial_StateTransition__From_EmptyTag (); Partial_StateTransition__From_EmptyTag__To_EmptyTag (); Partial_StateTransition__To_EmptyTag (); break; default: State = ParserState.NonEmptyTagError; Partial_StateTransition__From_EmptyTag (); Partial_StateTransition__From_EmptyTag__To_NonEmptyTagError (); Partial_StateTransition__To_NonEmptyTagError (); break; } break; case ParserState.CommentTag: switch (CurrentCharacter) { default: Partial_StateTransition__From_CommentTag (); Partial_StateTransition__From_CommentTag__To_CommentTag (); Partial_StateTransition__To_CommentTag (); break; } break; case ParserState.EndOfPreProcessorTag: switch (CurrentCharacter) { default: State = ParserState.PreProcessing; Partial_StateTransition__From_EndOfPreProcessorTag (); Partial_StateTransition__From_EndOfPreProcessorTag__To_PreProcessing (); Partial_StateTransition__To_PreProcessing (); goto apply; break; } break; case ParserState.EndOfObjectTag: switch (CurrentCharacter) { default: State = ParserState.Indention; Partial_StateTransition__From_EndOfObjectTag (); Partial_StateTransition__From_EndOfObjectTag__To_Indention (); Partial_StateTransition__To_Indention (); goto apply; break; } break; case ParserState.EndOfEmptyTag: switch (CurrentCharacter) { default: State = ParserState.Indention; Partial_StateTransition__From_EndOfEmptyTag (); Partial_StateTransition__From_EndOfEmptyTag__To_Indention (); Partial_StateTransition__To_Indention (); goto apply; break; } break; case ParserState.EndOfValueTag: switch (CurrentCharacter) { default: State = ParserState.Indention; Partial_StateTransition__From_EndOfValueTag (); Partial_StateTransition__From_EndOfValueTag__To_Indention (); Partial_StateTransition__To_Indention (); goto apply; break; } break; case ParserState.EndOfCommentTag: switch (CurrentCharacter) { default: State = ParserState.Indention; Partial_StateTransition__From_EndOfCommentTag (); Partial_StateTransition__From_EndOfCommentTag__To_Indention (); Partial_StateTransition__To_Indention (); goto apply; break; } break; case ParserState.ValueLine: switch (CurrentCharacter) { default: Partial_StateTransition__From_ValueLine (); Partial_StateTransition__From_ValueLine__To_ValueLine (); Partial_StateTransition__To_ValueLine (); break; } break; case ParserState.EndOfValueLine: switch (CurrentCharacter) { default: State = ParserState.Indention; Partial_StateTransition__From_EndOfValueLine (); Partial_StateTransition__From_EndOfValueLine__To_Indention (); Partial_StateTransition__To_Indention (); goto apply; break; } break; default: Result = ParserResult.Error; break; } } if (Result == ParserResult.Error) { return false; } // EndOfLine CurrentCharacter = EndOfStream; { switch (State) { case ParserState.Indention: State = ParserState.EndOfEmptyTag; Partial_StateTransition__From_Indention (); Partial_StateTransition__From_Indention__To_EndOfEmptyTag (); Partial_StateTransition__To_EndOfEmptyTag (); break; case ParserState.TagExpected: State = ParserState.EndOfEmptyTag; Partial_StateTransition__From_TagExpected (); Partial_StateTransition__From_TagExpected__To_EndOfEmptyTag (); Partial_StateTransition__To_EndOfEmptyTag (); break; case ParserState.NoContentTagExpected: State = ParserState.EndOfEmptyTag; Partial_StateTransition__From_NoContentTagExpected (); Partial_StateTransition__From_NoContentTagExpected__To_EndOfEmptyTag (); Partial_StateTransition__To_EndOfEmptyTag (); break; case ParserState.PreProcessorTag: State = ParserState.EndOfPreProcessorTag; Partial_StateTransition__From_PreProcessorTag (); Partial_StateTransition__From_PreProcessorTag__To_EndOfPreProcessorTag (); Partial_StateTransition__To_EndOfPreProcessorTag (); break; case ParserState.ObjectTag: State = ParserState.EndOfObjectTag; Partial_StateTransition__From_ObjectTag (); Partial_StateTransition__From_ObjectTag__To_EndOfObjectTag (); Partial_StateTransition__To_EndOfObjectTag (); break; case ParserState.ValueTag: State = ParserState.EndOfValueTag; Partial_StateTransition__From_ValueTag (); Partial_StateTransition__From_ValueTag__To_EndOfValueTag (); Partial_StateTransition__To_EndOfValueTag (); break; case ParserState.EmptyTag: State = ParserState.EndOfEmptyTag; Partial_StateTransition__From_EmptyTag (); Partial_StateTransition__From_EmptyTag__To_EndOfEmptyTag (); Partial_StateTransition__To_EndOfEmptyTag (); break; case ParserState.CommentTag: State = ParserState.EndOfCommentTag; Partial_StateTransition__From_CommentTag (); Partial_StateTransition__From_CommentTag__To_EndOfCommentTag (); Partial_StateTransition__To_EndOfCommentTag (); break; case ParserState.ValueLine: State = ParserState.EndOfValueLine; Partial_StateTransition__From_ValueLine (); Partial_StateTransition__From_ValueLine__To_EndOfValueLine (); Partial_StateTransition__To_EndOfValueLine (); break; } } Partial_EndLine (); return Result != ParserResult.Error; }
public void Object_Begin(SubString name) { m_stack.Push(new Item(name)); }
public void Empty(SubString line) { Visitor.Empty(line.Value); }
public void Error(int lineNo, SubString line, Scanner.Error parseError) { Errors.Add(new HRONDynamicParseError(lineNo, line.Value, GetParseError (parseError))); }
public override void Apply(SubString name, IHRONVisitor visitor) { if (visitor == null) { return; } visitor.Value_Begin(name); foreach (var line in m_value.ReadLines()) { visitor.Value_Line(line); } visitor.Value_End(name); }
public void Empty(SubString line) { }
public void Value_Line(SubString value) { if (m_firstLine) { m_firstLine = false; } else { m_value.AppendLine(); } m_value.Append(value); }
public Item(SubString name) : this() { Name = name; Pairs = new List<HRONObject.Member>(); }