Example #1
0
        } /* end ParseDiagnostics */

/* ---------------------------------------------------------------------------
 * private method SetOption(option)
 * ---------------------------------------------------------------------------
 * Sets option unless duplicate.
 * ------------------------------------------------------------------------ */

        private static void SetOption(Option option, bool value)
        {
            if (CompilerOptions.IsMutableOption(option) == false)
            {
                ReportInvalidOption(ArgumentLexer.LastArg());
            }
            else if (IsInOptionSet(option))
            {
                ReportDuplicateOption(ArgumentLexer.LastArg());
            }
            else
            {
                CompilerOptions.SetOption(option, value);
                StoreInOptionSet(option);
            } /* end if */
        }     /* end SetOption */
Example #2
0
        } /* end ParseDialect */

/* ---------------------------------------------------------------------------
 * private method ParseProducts(sym)
 * ---------------------------------------------------------------------------
 * products :
 *   ( singleProduct | multipleProducts ) identifierOption? commentOption?
 *   ;
 * ------------------------------------------------------------------------ */

        private static ArgumentToken ParseProducts(ArgumentToken sym)
        {
            if (ArgumentLexer.IsSingleProductOption(sym))
            {
                sym = ParseSingleProduct(sym);
            }
            else if (ArgumentLexer.IsMultipleProductsOption(sym))
            {
                sym = ParseMultipleProducts(sym);
            } /* end if */

            if (ArgumentLexer.IsIdentifierOption(sym))
            {
                if (CompilerOptions.XlatRequired() || CompilerOptions.ObjRequired())
                {
                    sym = ParseIdentifierOption(sym);
                }
                else
                {
                    ReportMissingDependencyFor(ArgumentLexer.LastArg(), "--xlat or --obj");
                    sym = ArgumentLexer.NextToken();
                } /* end if */
            }     /* end if */

            if (ArgumentLexer.IsCommentOption(sym))
            {
                if (CompilerOptions.XlatRequired() || CompilerOptions.ObjRequired())
                {
                    sym = ParseCommentOption(sym);
                }
                else
                {
                    ReportMissingDependencyFor(ArgumentLexer.LastArg(), "--xlat");
                    sym = ArgumentLexer.NextToken();
                } /* end if */
            }     /* end if */

            return(sym);
        } /* end ParseProducts */
Example #3
0
        } /* end ArgumentParser */

/* ---------------------------------------------------------------------------
 * method ParseOptions()
 * ---------------------------------------------------------------------------
 * options :
 *   infoRequest | compilationRequest
 *   ;
 * ------------------------------------------------------------------------ */

        public static ArgumentStatus ParseOptions(string[] args)
        {
            ArgumentToken sym;

            ArgumentLexer.InitWithArgs(args);
            sourceFile = null;
            errorCount = 0;
            optionSet  = 0;

            sym = ArgumentLexer.NextToken();

            if (ArgumentLexer.IsInfoRequest(sym))
            {
                sym = ParseInfoRequest(sym);
            }
            else if (ArgumentLexer.IsCompilationRequest(sym))
            {
                sym = ParseCompilationRequest(sym);
            }
            else if (sym == ArgumentToken.END_OF_INPUT)
            {
                ReportMissingSourceFile();
            } /* end if */

            while (sym != ArgumentToken.END_OF_INPUT)
            {
                ReportExcessArgument(ArgumentLexer.LastArg());
                sym = ArgumentLexer.NextToken();
            } /* end while */

            if (errorCount > 0)
            {
                status = ArgumentStatus.ErrorsEncountered;
            } /* end if */

            return(status);
        } /* end ParseOptions */
Example #4
0
        } /* end ParseCapabilities */

/* ---------------------------------------------------------------------------
 * private method ParseSourceFile(sym)
 * ---------------------------------------------------------------------------
 * sourceFile :
 *   <platform dependendent path/filename>
 *   ;
 * ------------------------------------------------------------------------ */

        private static ArgumentToken ParseSourceFile(ArgumentToken sym)
        {
            sourceFile = ArgumentLexer.LastArg();
            return(ArgumentLexer.NextToken());
        } /* end  */