public static (TreeStr t, ScanStr) Parse(this ParserStr p, string input) { var t = p.Load(new ScanStr(input)).Parse().Dump(); using var env = EnvWriter.Begin(); env.WriteLine($"---- match {p.matchn} / loc {p.locn} = {p.matchn / Math.Max(p.locn, 1)} ----"); return(t, p.scan); }
private void tomaSugerencia() { Variable v = (Variable)ambitoPregunta.getSimbolo("sugerir"); if (v != null) { if (v.valor is String) { this.sugerencia = (String)v.valor; ParserStr p = new ParserStr(this.sugerencia); String n = p.reemplazaCadena(); if (!this.sugerencia.Equals(n)) { this.sugerencia = n; } } } }
private void tomaEtiqueta() { Variable v = (Variable)ambitoPregunta.getSimbolo("etiqueta"); if (v != null) { if (v.valor is String) { this.etiqueta = (String)v.valor; ParserStr p = new ParserStr(this.etiqueta); String n = p.reemplazaCadena(); if (!this.etiqueta.Equals(n)) { this.etiqueta = n; } } } }
public static bool Check(this ParserStr p, string input) => p.Load(new ScanStr(input)).Check();