Beispiel #1
0
        private ScriptVarLink ParseDefinition(ScriptLex.LexTypes lexType)
        {
            currentLexer.Match(lexType);
            var funcName = string.Empty;

            //named function
            if (currentLexer.TokenType == ScriptLex.LexTypes.Id)
            {
                funcName = currentLexer.TokenString;
                currentLexer.Match(ScriptLex.LexTypes.Id);
            }

            var funcVar = new ScriptVarLink(new ScriptVar(null, ScriptVar.Flags.Function), funcName);

            if (lexType == ScriptLex.LexTypes.RFunction || lexType == ScriptLex.LexTypes.RCatch)
            {
                ParseFunctionArguments(funcVar.Var);
            }

            var funcBegin = currentLexer.TokenStart;
            var noExecute = false;

            Block(ref noExecute);
            funcVar.Var.SetData(currentLexer.GetSubString(funcBegin));

            return(funcVar);
        }
Beispiel #2
0
        private ScriptVarLink ParseFunctionDefinition()
        {
            _currentLexer.Match(ScriptLex.LexTypes.RFunction);
            String funcName = String.Empty;

            //named function
            if (_currentLexer.TokenType == ScriptLex.LexTypes.Id)
            {
                funcName = _currentLexer.TokenString;
                _currentLexer.Match(ScriptLex.LexTypes.Id);
            }

            ScriptVarLink funcVar = new ScriptVarLink(new ScriptVar(null, ScriptVar.Flags.Function), funcName);

            ParseFunctionArguments(funcVar.Var);

            Int32 funcBegin = _currentLexer.TokenStart;
            bool  execute   = false;

            Block(ref execute);
            funcVar.Var.SetData(_currentLexer.GetSubString(funcBegin));

            return(funcVar);
        }