Beispiel #1
0
        /// <summary>
        /// Base procedure to parsing whole grammar
        /// </summary>
        /// <param name="tokens"></param>
        /// <param name="result"></param>
        public static void ParseGrammarBase(IList <AbstractToken> tokens, ref GrammarCreator result)
        {
            if (result == null)
            {
                result = new GrammarCreator();
            }
            int cur = 0;
            List <ValueTuple <string, string[], RuleExpressionFactory[]> > grammarContent;

            try
            {
                grammarContent = ParseAllGrammar(tokens, ref cur);
            }
            catch (IndexOutOfRangeException ex)
            {
                throw new ParserErrorException("Unexpected end of file", ex);
            }

            foreach (var rule_content in grammarContent)
            {
                result.RegisterRule(rule_content.Item1, rule_content.Item2, rule_content.Item3);
            }
        }
Beispiel #2
0
 private void Awake()
 {
     instance = this;
 }