Beispiel #1
0
        private void ParseLeftAssocBinOpTail(int start, Func <TokenNodeType, bool> matchOperator, Func <bool> parsePart, string ErrorMsg = "An operand expected")
        {
            while (matchOperator(builder.GetTokenType()))
            {
                AdvanceLexerSkipNonsemantical();
                if (!parsePart())
                {
                    builder.Error(ErrorMsg);
                }

                builder.DoneBeforeWhitespaces(start, SpringCompositeNodeType.BIN_OP, null);
                builder.Precede(start);
            }
        }
Beispiel #2
0
        private bool ParseMedium(PsiBuilder builder)
        {
            var start = builder.Mark();

            if (!ParseHigh(builder))
            {
                builder.Drop(start);
                return(false);
            }

            while (builder.GetTokenType() == SpringTokenType.MEDIUM_BINOP)
            {
                AdvanceWithSpaces(builder);

                if (!ParseHigh(builder))
                {
                    builder.Drop(start);
                    return(false);
                }

                builder.DoneBeforeWhitespaces(start, SpringCompositeNodeType.MEDIUM_BINOP, null);
                builder.Precede(start);
            }

            builder.Drop(start);
            return(true);
        }