Antlr4.AntlrTool.HandleOptionSetArg C# (CSharp) Method

HandleOptionSetArg() protected method

protected HandleOptionSetArg ( string arg ) : void
arg string
return void
        protected virtual void HandleOptionSetArg(string arg)
        {
            int eq = arg.IndexOf('=');
            if (eq > 0 && arg.Length > 3)
            {
                string option = arg.Substring("-D".Length, eq - "-D".Length);
                string value = arg.Substring(eq + 1);
                if (value.Length == 0)
                {
                    errMgr.ToolError(ErrorType.BAD_OPTION_SET_SYNTAX, arg);
                    return;
                }
                if (Grammar.parserOptions.Contains(option) ||
                     Grammar.lexerOptions.Contains(option))
                {
                    if (grammarOptions == null)
                        grammarOptions = new Dictionary<string, string>();
                    grammarOptions[option] = value;
                }
                else
                {
                    errMgr.GrammarError(ErrorType.ILLEGAL_OPTION,
                                        null,
                                        null,
                                        option);
                }
            }
            else
            {
                errMgr.ToolError(ErrorType.BAD_OPTION_SET_SYNTAX, arg);
            }
        }