Example #1
0
 public TraitParser() : base($"^ /('trait' /s+) /({REGEX_VARIABLE})")
 {
     bodyParser      = new TraitBodyParser();
     doesParser      = new DoesParser();
     endOfLineParser = new EndOfLineParser();
     traits          = new List <string>();
 }
Example #2
0
        public static (string, Parameters, string[], int) Ancestors(string source, int index)
        {
            var        inheritanceParser = new InheritanceParser();
            var        doesParser        = new DoesParser();
            var        superName         = "";
            Parameters superParameters   = null;

            if (inheritanceParser.Scan(source, index))
            {
                superName       = inheritanceParser.VariableName;
                superParameters = inheritanceParser.Parameters;
                index           = inheritanceParser.Result.Position;
            }

            var traits = new List <string>();

            if (doesParser.Scan(source, index))
            {
                traits = doesParser.Traits;
                index  = doesParser.Result.Position;
            }

            return(superName, superParameters, traits.ToArray(), index);
        }
Example #3
0
 public UnionParser()
     : base($"^ /(/s*) /('union') /(/s*) /({REGEX_VARIABLE})")
 {
     inheritanceParser = new InheritanceParser();
     doesParser        = new DoesParser();
 }
 public AnonymousObjectParser()
     : base("^ /(/s* '!') '{'")
 {
     inheritanceParser = new InheritanceParser();
     doesParser        = new DoesParser();
 }