[edk2-devel] [PATCH] BaseTools: VfrCompile/Pccts: Fix invalid bytes

Bob Feng bob.c.feng at intel.com
Mon May 13 08:16:53 UTC 2019


Hi Joe,

Please submit a Bugzilla (https://bugzilla.tianocore.org/) and add the BZ link to the commit message.

This patch looks good to me.

Thanks,
Bob

-----Original Message-----
From: Joe Richey [mailto:joerichey at google.com] 
Sent: Saturday, May 11, 2019 12:24 PM
To: devel at edk2.groups.io
Cc: Feng, Bob C <bob.c.feng at intel.com>; Gao, Liming <liming.gao at intel.com>; Zhu, Yonghong <yonghong.zhu at intel.com>
Subject: [PATCH] BaseTools: VfrCompile/Pccts: Fix invalid bytes

Three text files have invalid ASCII bytes, this can mess up tooling that trys to operate on the repository, which will accidentally classify them as binary data.

https://github.com/josephlr/edk2/tree/format

Cc: Bob Feng <bob.c.feng at intel.com>
Cc: Liming Gao <liming.gao at intel.com>
Cc: Yonghong Zhu <yonghong.zhu at intel.com>
Signed-off-by: Joe Richey <joerichey at google.com>
---
 BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt |  2 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt   | 78 ++++++++++----------
 BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt       |  6 +-
 3 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt b/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt
index 539cf775257b..f073e620ab68 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt
+++ b/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt
@@ -40,7 +40,7 @@
     An bug (or at least an oddity) is that a reference to LT(1), LA(1),
     or LATEXT(1) in an action which immediately follows a token match
     in a rule refers to the token matched, not the token which is in
-    the lookahead buffer.  Consider:
+    the lookahead buffer.  Consider:
 
         r : abc <<action alpha>> D <<action beta>> E;
 
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
index 4a7d22e7f239..140b064217b7 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
@@ -9,48 +9,48 @@ NAME
      antlr - ANother Tool for Language Recognition
 
 SYNTAX
-     antlr [_o_p_t_i_o_n_s] _g_r_a_m_m_a_r__f_i_l_e_s
+     antlr [options] grammar_files
 
 DESCRIPTION
-     _A_n_t_l_r converts an extended form of context-free grammar into
+     Antlr converts an extended form of context-free grammar into
      a set of C functions which directly implement an efficient
      form of deterministic recursive-descent LL(k) parser.
      Context-free grammars may be augmented with predicates to
      allow semantics to influence parsing; this allows a form of
      context-sensitive parsing.  Selective backtracking is also
      available to handle non-LL(k) and even non-LALR(k) con-
-     structs.  _A_n_t_l_r also produces a definition of a lexer which
+     structs.  Antlr also produces a definition of a lexer which
      can be automatically converted into C code for a DFA-based
-     lexer by _d_l_g.  Hence, _a_n_t_l_r serves a function much like that
-     of _y_a_c_c, however, it is notably more flexible and is more
-     integrated with a lexer generator (_a_n_t_l_r directly generates
-     _d_l_g code, whereas _y_a_c_c and _l_e_x are given independent
-     descriptions).  Unlike _y_a_c_c which accepts LALR(1) grammars,
-     _a_n_t_l_r accepts LL(k) grammars in an extended BNF notation -
+     lexer by dlg.  Hence, antlr serves a function much like that
+     of yacc, however, it is notably more flexible and is more
+     integrated with a lexer generator (antlr directly generates
+     dlg code, whereas yacc and lex are given independent
+     descriptions).  Unlike yacc which accepts LALR(1) grammars,
+     antlr accepts LL(k) grammars in an extended BNF notation -
      which eliminates the need for precedence rules.
 
-     Like _y_a_c_c grammars, _a_n_t_l_r grammars can use automatically-
+     Like yacc grammars, antlr grammars can use automatically-
      maintained symbol attribute values referenced as dollar
-     variables.  Further, because _a_n_t_l_r generates top-down
+     variables.  Further, because antlr generates top-down
      parsers, arbitrary values may be inherited from parent rules
-     (passed like function parameters).  _A_n_t_l_r also has a mechan-
+     (passed like function parameters).  Antlr also has a mechan-
      ism for creating and manipulating abstract-syntax-trees.
 
-     There are various other niceties in _a_n_t_l_r, including the
+     There are various other niceties in antlr, including the
      ability to spread one grammar over multiple files or even
      multiple grammars in a single file, the ability to generate
      a version of the grammar with actions stripped out (for
      documentation purposes), and lots more.
 
 OPTIONS
-     -ck _n
-          Use up to _n symbols of lookahead when using compressed
+     -ck n
+          Use up to n symbols of lookahead when using compressed
           (linear approximation) lookahead.  This type of looka-
           head is very cheap to compute and is attempted before
           full LL(k) lookahead, which is of exponential complex-
           ity in the worst case.  In general, the compressed loo-
-          kahead can be much deeper (e.g, -ck 10) _t_h_a_n _t_h_e _f_u_l_l
-          _l_o_o_k_a_h_e_a_d (_w_h_i_c_h _u_s_u_a_l_l_y _m_u_s_t _b_e _l_e_s_s _t_h_a_n _4).
+          kahead can be much deeper (e.g, -ck 10) than the full
+          lookahead (which usually must be less than 4).
 
      -CC  Generate C++ output from both ANTLR and DLG.
 
@@ -86,20 +86,20 @@ OPTIONS
 
      -ga  Generate ANSI-compatible code (default case).  This has
           not been rigorously tested to be ANSI XJ11 C compliant,
-          but it is close.  The normal output of _a_n_t_l_r is
+          but it is close.  The normal output of antlr is
           currently compilable under both K&R, ANSI C, and C++-
-          this option does nothing because _a_n_t_l_r generates a
+          this option does nothing because antlr generates a
           bunch of #ifdef's to do the right thing depending on
           the language.
 
-     -gc  Indicates that _a_n_t_l_r should generate no C code, i.e.,
+     -gc  Indicates that antlr should generate no C code, i.e.,
           only perform analysis on the grammar.
 
-     -gd  C code is inserted in each of the _a_n_t_l_r generated pars-
+     -gd  C code is inserted in each of the antlr generated pars-
           ing functions to provide for user-defined handling of a
           detailed parse trace.  The inserted code consists of
           calls to the user-supplied macros or functions called
-          zzTRACEIN and zzTRACEOUT.  The only argument is a _c_h_a_r
+          zzTRACEIN and zzTRACEOUT.  The only argument is a char
           * pointing to a C-style string which is the grammar
           rule recognized by the current parsing function.  If no
           definition is given for the trace functions, upon rule @@ -110,17 +110,17 @@ OPTIONS
 
      -gh  Generate stdpccts.h for non-ANTLR-generated files to
           include.  This file contains all defines needed to
-          describe the type of parser generated by _a_n_t_l_r (e.g.
+          describe the type of parser generated by antlr (e.g.
           how much lookahead is used and whether or not trees are
           constructed) and contains the header action specified
           by the user.
 
      -gk  Generate parsers that delay lookahead fetches until
-          needed.  Without this option, _a_n_t_l_r generates parsers
-          which always have _k tokens of lookahead available.
+          needed.  Without this option, antlr generates parsers
+          which always have k tokens of lookahead available.
 
      -gl  Generate line info about grammar actions in C parser of
-          the form # _l_i_n_e "_f_i_l_e" which makes error messages from
+          the form # line "file" which makes error messages from
           the C/C++ compiler make more sense as they will point
           into the grammar file not the resulting C file.
           Debugging is easier as well, because you will step @@ -128,18 +128,18 @@ OPTIONS
 
      -gs  Do not generate sets for token expression lists;
           instead generate a ||-separated sequence of
-          LA(1)==_t_o_k_e_n__n_u_m_b_e_r.  The default is to generate sets.
+          LA(1)==token_number.  The default is to generate sets.
 
      -gt  Generate code for Abstract-Syntax Trees.
 
      -gx  Do not create the lexical analyzer files (dlg-related).
           This option should be given when the user wishes to
           provide a customized lexical analyzer.  It may also be
-          used in _m_a_k_e scripts to cause only the parser to be
+          used in make scripts to cause only the parser to be
           rebuilt when a change not affecting the lexical struc-
           ture is made to the input grammars.
 
-     -k _n Set k of LL(k) to _n; i.e. set tokens of look-ahead
+     -k n Set k of LL(k) to n; i.e. set tokens of look-ahead
           (default==1).
 
      -o dir
@@ -171,9 +171,9 @@ OPTIONS
           release with option -pr on.  Context computation is off
           by default.
 
-     -rl _n
+     -rl n
           Limit the maximum number of tree nodes used by grammar
-          analysis to _n.  Occasionally, _a_n_t_l_r is unable to
+          analysis to n.  Occasionally, antlr is unable to
           analyze a grammar submitted by the user.  This rare
           situation can only occur when the grammar is large and
           the amount of lookahead is greater than one.  A non- @@ -184,14 +184,14 @@ OPTIONS
           the number of calls to the full LL(k) algorithm.  An
           error message will be displayed, if this limit is
           reached, which indicates the grammar construct being
-          analyzed when _a_n_t_l_r hit a non-linearity.  Use this
-          option if _a_n_t_l_r seems to go out to lunch and your disk
-          start thrashing; try _n=10000 to start.  Once the
+          analyzed when antlr hit a non-linearity.  Use this
+          option if antlr seems to go out to lunch and your disk
+          start thrashing; try n=10000 to start.  Once the
           offending construct has been identified, try to remove
-          the ambiguity that _a_n_t_l_r was trying to overcome with
+          the ambiguity that antlr was trying to overcome with
           large lookahead analysis.  The introduction of (...)?
           backtracking blocks eliminates some of these problems -
-          _a_n_t_l_r does not analyze alternatives that begin with
+          antlr does not analyze alternatives that begin with
           (...)? (it simply backtracks, if necessary, at run
           time).
 
@@ -208,7 +208,7 @@ OPTIONS
           as the parser file.
 
 SPECIAL CONSIDERATIONS
-     _A_n_t_l_r works...  we think.  There is no implicit guarantee of
+     Antlr works...  we think.  There is no implicit guarantee of
      anything.  We reserve no legal rights to the software known
      as the Purdue Compiler Construction Tool Set (PCCTS) - PCCTS
      is in the public domain.  An individual or company may do @@ -234,7 +234,7 @@ FILES
           output C++ parser when C++ mode is used.
 
      parser.dlg
-          output _d_l_g lexical analyzer.
+          output dlg lexical analyzer.
 
      err.c
           token string array, error sets and error support rou- @@ -251,7 +251,7 @@ FILES
           erated by default.  Not used in C++ mode.
 
      tokens.h
-          output #_d_e_f_i_n_e_s for tokens used and function prototypes
+          output #defines for tokens used and function prototypes
           for functions generated for rules.
 
 
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt b/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt
index 06b320de2abb..5ea5e933c808 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt
+++ b/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt
@@ -9,14 +9,14 @@ NAME
      dlg - DFA Lexical Analyzer Generator
 
 SYNTAX
-     dlg [_o_p_t_i_o_n_s] _l_e_x_i_c_a_l__s_p_e_c [_o_u_t_p_u_t__f_i_l_e]
+     dlg [options] lexical_spec [output_file]
 
 DESCRIPTION
      dlg is a tool that produces fast deterministic finite auto-
      mata for recognizing regular expressions in input.
 
 OPTIONS
-     -CC  Generate C++ output.  The _o_u_t_p_u_t__f_i_l_e is not specified
+     -CC  Generate C++ output.  The output_file is not specified
           in this case.
 
      -C[ level]
@@ -69,7 +69,7 @@ OPTIONS
           in or send output to standard out.
 
 SPECIAL CONSIDERATIONS
-     _D_l_g works...  we think.  There is no implicit guarantee of
+     Dlg works...  we think.  There is no implicit guarantee of
      anything.  We reserve no legal rights to the software known
      as the Purdue Compiler Construction Tool Set (PCCTS) - PCCTS
      is in the public domain.  An individual or company may do
--
2.21.0.1020.gf2820cf01a-goog


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40487): https://edk2.groups.io/g/devel/message/40487
Mute This Topic: https://groups.io/mt/31584915/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list