From: "Zhang, Shenglei" <shenglei.zhang@intel.com>
To: "Chen, Yuwei" <yuwei.chen@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"Fan, ZhijuX" <zhijux.fan@intel.com>
Cc: "Feng, Bob C" <bob.c.feng@intel.com>,
"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update the contents of CParser4
Date: Fri, 5 Jun 2020 05:11:01 +0000 [thread overview]
Message-ID: <C0706E73DB8C124D9B9C38AA364E5D5E06098B92@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <DM5PR11MB159462CDC8A6FFA818BBA67296860@DM5PR11MB1594.namprd11.prod.outlook.com>
Yuwei,
I'm also not familiar with that. I attached this patch in patch series because people can't run Ecc
with py38 if they want to use my script. Zhiju is the original author.
Zhiju,
Could you help answer Yuwei's question?
Thanks,
Shenglei
> -----Original Message-----
> From: Chen, Yuwei
> Sent: Friday, June 5, 2020 12:39 PM
> To: devel@edk2.groups.io; Zhang, Shenglei <shenglei.zhang@intel.com>
> Cc: Fan, ZhijuX <zhijux.fan@intel.com>; Feng, Bob C
> <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: RE: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update the
> contents of CParser4
>
> Hi, Shenglei
>
> Since the input arguments number of the getText() function changed, the
> build failed. May be you should check about the getText() function's input.
> While how to choose the CParser4 and CParser3, I am not familiar with it,
> would you like to explain for me?
>
> Thanks,
> Yuwei
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zhang,
> > Shenglei
> > Sent: Wednesday, June 3, 2020 4:48 PM
> > To: devel@edk2.groups.io
> > Cc: Fan, ZhijuX <zhijux.fan@intel.com>; Feng, Bob C
> > <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> > Subject: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update the
> > contents of CParser4
> >
> > From: "Fan, Zhiju" <zhijux.fan@intel.com>
> >
> > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2676
> >
> > Because Ecc relies on the antlr extension package, When the antlr version is
> > updated, we need to change the code in it.
> > Currently, if you use the latest version antlr4.8, Ecc will fail
> >
> > We will update the version to support the use of antlr4.8 and all previous
> > versions will have errors.This can be resolved by installing the antlr4.8
> version.
> > Installation method: pip install antlr4-python3-runtime==4.8
> >
> > This patch is going to fixed this issue
> >
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> > ---
> > .../Source/Python/Ecc/CParser4/CLexer.py | 6 +--
> > .../Source/Python/Ecc/CParser4/CListener.py | 4 +-
> > .../Source/Python/Ecc/CParser4/CParser.py | 38 ++++++++++---------
> > 3 files changed, 25 insertions(+), 23 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/Ecc/CParser4/CLexer.py
> > b/BaseTools/Source/Python/Ecc/CParser4/CLexer.py
> > index a2cc5bf56e66..40e2afbf1a1f 100644
> > --- a/BaseTools/Source/Python/Ecc/CParser4/CLexer.py
> > +++ b/BaseTools/Source/Python/Ecc/CParser4/CLexer.py
> > @@ -1,4 +1,4 @@
> > -# Generated from C.g4 by ANTLR 4.7.1
> > +# Generated from C.g4 by ANTLR 4.8
> > from antlr4 import *
> > from io import StringIO
> > from typing.io import TextIO
> > @@ -12,7 +12,7 @@ import sys
> > # This file is generated by running:
> > # java org.antlr.Tool C.g
> > #
> > -# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
> > +# Copyright (c) 2009 - 2020, Intel Corporation All rights reserved.
> > #
> > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -584,7 +584,7 @@
> > class CLexer(Lexer):
> > # @param output= sys.stdout Type: TextIO
> > def __init__(self,input=None,output= sys.stdout):
> > super().__init__(input, output)
> > - self.checkVersion("4.7.1")
> > + self.checkVersion("4.8")
> > self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA,
> > PredictionContextCache())
> > self._actions = None
> > self._predicates = None
> > diff --git a/BaseTools/Source/Python/Ecc/CParser4/CListener.py
> > b/BaseTools/Source/Python/Ecc/CParser4/CListener.py
> > index bb4351d9249a..ba7e70892680 100644
> > --- a/BaseTools/Source/Python/Ecc/CParser4/CListener.py
> > +++ b/BaseTools/Source/Python/Ecc/CParser4/CListener.py
> > @@ -1,4 +1,4 @@
> > -# Generated from C.g4 by ANTLR 4.7.1
> > +# Generated from C.g4 by ANTLR 4.8
> > from antlr4 import *
> > if __name__ is not None and "." in __name__:
> > from .CParser import CParser
> > @@ -12,7 +12,7 @@ else:
> > # This file is generated by running:
> > # java org.antlr.Tool C.g
> > #
> > -# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
> > +# Copyright (c) 2009 - 2020, Intel Corporation All rights reserved.
> > #
> > # SPDX-License-Identifier: BSD-2-Clause-Patent # diff --git
> > a/BaseTools/Source/Python/Ecc/CParser4/CParser.py
> > b/BaseTools/Source/Python/Ecc/CParser4/CParser.py
> > index 31d23d55aa57..30d70a74e669 100644
> > --- a/BaseTools/Source/Python/Ecc/CParser4/CParser.py
> > +++ b/BaseTools/Source/Python/Ecc/CParser4/CParser.py
> > @@ -1,10 +1,12 @@
> > -# Generated from C.g4 by ANTLR 4.7.1
> > +# Generated from C.g4 by ANTLR 4.8
> > # encoding: utf-8
> > from antlr4 import *
> > from io import StringIO
> > -from typing.io import TextIO
> > import sys
> > -
> > +if sys.version_info[1] > 5:
> > + from typing import TextIO
> > +else:
> > + from typing.io import TextIO
> >
> > ## @file
> > # The file defines the parser for C source files.
> > @@ -13,7 +15,7 @@ import sys
> > # This file is generated by running:
> > # java org.antlr.Tool C.g
> > #
> > -# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
> > +# Copyright (c) 2009 - 2020, Intel Corporation All rights reserved.
> > #
> > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -739,7 +741,7 @@
> > class CParser ( Parser ):
> > # @param output= sys.stdout Type: TextIO
> > def __init__(self,input,output= sys.stdout):
> > super().__init__(input, output)
> > - self.checkVersion("4.7.1")
> > + self.checkVersion("4.8")
> > self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA,
> > self.sharedContextCache)
> > self._predicates = None
> >
> > @@ -1062,10 +1064,10 @@ class CParser ( Parser ):
> >
> >
> > if localctx.d != None:
> > - ModifierText = (None if localctx._declaration_specifiers is None
> else
> >
> self._input.getText((localctx._declaration_specifiers.start,localctx._declarati
> > on_specifiers.stop)))
> > + ModifierText = (None if
> > + localctx._declaration_specifiers is None else
> > + self._input.getText(localctx._declaration_specifiers.start,localctx._d
> > + eclaration_specifiers.stop))
> > else:
> > ModifierText = ''
> > - DeclText = (None if localctx._declarator is None else
> > self._input.getText((localctx._declarator.start,localctx._declarator.stop)))
> > + DeclText = (None if localctx._declarator is None else
> > + self._input.getText(localctx._declarator.start,localctx._declarator.st
> > + op))
> > DeclLine = (None if localctx._declarator is None else
> > localctx._declarator.start).line
> > DeclOffset = (None if localctx._declarator is None else
> > localctx._declarator.start).column
> > if localctx.a != None:
> > @@ -1245,9 +1247,9 @@ class CParser ( Parser ):
> > localctx.d = self.match(CParser.T__1)
> >
> > if localctx.b is not None:
> > - self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, (0
> if
> > localctx.d is None else localctx.d.line), localctx.d.column, (None if localctx.b
> is
> > None else self._input.getText((localctx.b.start,localctx.b.stop))), (None if
> > localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
> > + self.StoreTypedefDefinition(localctx.a.line,
> > + localctx.a.column, (0 if localctx.d is None else localctx.d.line),
> > + localctx.d.column, (None if localctx.b is None else
> > + self._input.getText(localctx.b.start,localctx.b.stop)), (None if
> > + localctx.c is None else
> > + self._input.getText(localctx.c.start,localctx.c.stop)))
> > else:
> > - self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, (0
> if
> > localctx.d is None else localctx.d.line), localctx.d.column, '', (None if
> localctx.c
> > is None else self._input.getText((localctx.c.start,localctx.c.stop))))
> > + self.StoreTypedefDefinition(localctx.a.line,
> > + localctx.a.column, (0 if localctx.d is None else localctx.d.line),
> > + localctx.d.column, '', (None if localctx.c is None else
> > + self._input.getText(localctx.c.start,localctx.c.stop)))
> >
> > pass
> > elif token in [CParser.T__5, CParser.T__6, CParser.T__7,
> CParser.T__8,
> > CParser.T__9, CParser.T__10, CParser.T__11, CParser.T__12,
> CParser.T__13,
> > CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17,
> CParser.T__18,
> > CParser.T__20, CParser.T__21, CParser.T__23, CParser.T__24,
> CParser.T__25,
> > CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29,
> CParser.T__30,
> > CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34,
> CParser.T__35,
> > CParser.T__36, CParser.IDENTIFIER]:
> > @@ -1266,7 +1268,7 @@ class CParser ( Parser ):
> > localctx.e = self.match(CParser.T__1)
> >
> > if localctx.t is not None:
> > - self.StoreVariableDeclaration((None if localctx.s is None else
> > localctx.s.start).line, (None if localctx.s is None else localctx.s.start).column,
> > (None if localctx.t is None else localctx.t.start).line, (None if localctx.t is
> None
> > else localctx.t.start).column, (None if localctx.s is None else
> > self._input.getText((localctx.s.start,localctx.s.stop))), (None if localctx.t is
> > None else self._input.getText((localctx.t.start,localctx.t.stop))))
> > + self.StoreVariableDeclaration((None if localctx.s
> > + is None else localctx.s.start).line, (None if localctx.s is None else
> > + localctx.s.start).column, (None if localctx.t is None else
> > + localctx.t.start).line, (None if localctx.t is None else
> > + localctx.t.start).column, (None if localctx.s is None else
> > + self._input.getText(localctx.s.start,localctx.s.stop)), (None if
> > + localctx.t is None else
> > + self._input.getText(localctx.t.start,localctx.t.stop)))
> >
> > pass
> > else:
> > @@ -1568,7 +1570,7 @@ class CParser ( Parser ):
> > localctx.s = self.struct_or_union_specifier()
> >
> > if localctx.s.stop is not None:
> > - self.StoreStructUnionDefinition((None if localctx.s is None else
> > localctx.s.start).line, (None if localctx.s is None else localctx.s.start).column,
> > (None if localctx.s is None else localctx.s.stop).line, (None if localctx.s is
> None
> > else localctx.s.stop).column, (None if localctx.s is None else
> > self._input.getText((localctx.s.start,localctx.s.stop))))
> > + self.StoreStructUnionDefinition((None if localctx.s
> > + is None else localctx.s.start).line, (None if localctx.s is None else
> > + localctx.s.start).column, (None if localctx.s is None else
> > + localctx.s.stop).line, (None if localctx.s is None else
> > + localctx.s.stop).column, (None if localctx.s is None else
> > + self._input.getText(localctx.s.start,localctx.s.stop)))
> >
> > pass
> >
> > @@ -1578,7 +1580,7 @@ class CParser ( Parser ):
> > localctx.e = self.enum_specifier()
> >
> > if localctx.e.stop is not None:
> > - self.StoreEnumerationDefinition((None if localctx.e is None else
> > localctx.e.start).line, (None if localctx.e is None else
> localctx.e.start).column,
> > (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is
> > None else localctx.e.stop).column, (None if localctx.e is None else
> > self._input.getText((localctx.e.start,localctx.e.stop))))
> > + self.StoreEnumerationDefinition((None if localctx.e
> > + is None else localctx.e.start).line, (None if localctx.e is None else
> > + localctx.e.start).column, (None if localctx.e is None else
> > + localctx.e.stop).line, (None if localctx.e is None else
> > + localctx.e.stop).column, (None if localctx.e is None else
> > + self._input.getText(localctx.e.start,localctx.e.stop)))
> >
> > pass
> >
> > @@ -4022,7 +4024,7 @@ class CParser ( Parser ):
> > self.enterOuterAlt(localctx, 1)
> > self.state = 569
> > localctx.p = self.primary_expression()
> > - self.FuncCallText += (None if localctx.p is None else
> > self._input.getText((localctx.p.start,localctx.p.stop)))
> > + self.FuncCallText += (None if localctx.p is None else
> > + self._input.getText(localctx.p.start,localctx.p.stop))
> > self.state = 600
> > self._errHandler.sync(self)
> > _alt = self._interp.adaptivePredict(self._input,73,self._ctx)
> > @@ -4055,7 +4057,7 @@ class CParser ( Parser ):
> > localctx.c = self.argument_expression_list()
> > self.state = 580
> > localctx.b = self.match(CParser.T__38)
> > - self.StoreFunctionCalling((None if localctx.p is None else
> > localctx.p.start).line, (None if localctx.p is None else
> localctx.p.start).column,
> > (0 if localctx.b is None else localctx.b.line), localctx.b.column,
> > self.FuncCallText, (None if localctx.c is None else
> > self._input.getText((localctx.c.start,localctx.c.stop))))
> > + self.StoreFunctionCalling((None if localctx.p
> > + is None else localctx.p.start).line, (None if localctx.p is None else
> > + localctx.p.start).column, (0 if localctx.b is None else
> > + localctx.b.line), localctx.b.column, self.FuncCallText, (None if
> > + localctx.c is None else
> > + self._input.getText(localctx.c.start,localctx.c.stop)))
> > pass
> >
> > elif la_ == 4:
> > @@ -4770,7 +4772,7 @@ class CParser ( Parser ):
> > self.match(CParser.T__22)
> > self.state = 674
> > self.conditional_expression()
> > - self.StorePredicateExpression((None if localctx.e is None else
> > localctx.e.start).line, (None if localctx.e is None else
> localctx.e.start).column,
> > (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is
> > None else localctx.e.stop).column, (None if localctx.e is None else
> > self._input.getText((localctx.e.start,localctx.e.stop))))
> > + self.StorePredicateExpression((None if localctx.e is
> > + None else localctx.e.start).line, (None if localctx.e is None else
> > + localctx.e.start).column, (None if localctx.e is None else
> > + localctx.e.stop).line, (None if localctx.e is None else
> > + localctx.e.stop).column, (None if localctx.e is None else
> > + self._input.getText(localctx.e.start,localctx.e.stop)))
> >
> >
> > except RecognitionException as re:
> > @@ -6053,7 +6055,7 @@ class CParser ( Parser ):
> > localctx.e = self.expression()
> > self.state = 845
> > self.match(CParser.T__38)
> > - self.StorePredicateExpression((None if localctx.e is None else
> > localctx.e.start).line, (None if localctx.e is None else
> localctx.e.start).column,
> > (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is
> > None else localctx.e.stop).column, (None if localctx.e is None else
> > self._input.getText((localctx.e.start,localctx.e.stop))))
> > + self.StorePredicateExpression((None if localctx.e is
> > + None else localctx.e.start).line, (None if localctx.e is None else
> > + localctx.e.start).column, (None if localctx.e is None else
> > + localctx.e.stop).line, (None if localctx.e is None else
> > + localctx.e.stop).column, (None if localctx.e is None else
> > + self._input.getText(localctx.e.start,localctx.e.stop)))
> > self.state = 847
> > self.statement()
> > self.state = 850
> > @@ -6144,7 +6146,7 @@ class CParser ( Parser ):
> > self.match(CParser.T__38)
> > self.state = 864
> > self.statement()
> > - self.StorePredicateExpression((None if localctx.e is None else
> > localctx.e.start).line, (None if localctx.e is None else
> localctx.e.start).column,
> > (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is
> > None else localctx.e.stop).column, (None if localctx.e is None else
> > self._input.getText((localctx.e.start,localctx.e.stop))))
> > + self.StorePredicateExpression((None if localctx.e is
> > + None else localctx.e.start).line, (None if localctx.e is None else
> > + localctx.e.start).column, (None if localctx.e is None else
> > + localctx.e.stop).line, (None if localctx.e is None else
> > + localctx.e.stop).column, (None if localctx.e is None else
> > + self._input.getText(localctx.e.start,localctx.e.stop)))
> > pass
> > elif token in [CParser.T__87]:
> > self.enterOuterAlt(localctx, 2) @@ -6162,7 +6164,7 @@ class
> CParser
> > ( Parser ):
> > self.match(CParser.T__38)
> > self.state = 873
> > self.match(CParser.T__1)
> > - self.StorePredicateExpression((None if localctx.e is None else
> > localctx.e.start).line, (None if localctx.e is None else
> localctx.e.start).column,
> > (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is
> > None else localctx.e.stop).column, (None if localctx.e is None else
> > self._input.getText((localctx.e.start,localctx.e.stop))))
> > + self.StorePredicateExpression((None if localctx.e is
> > + None else localctx.e.start).line, (None if localctx.e is None else
> > + localctx.e.start).column, (None if localctx.e is None else
> > + localctx.e.stop).line, (None if localctx.e is None else
> > + localctx.e.stop).column, (None if localctx.e is None else
> > + self._input.getText(localctx.e.start,localctx.e.stop)))
> > pass
> > else:
> > raise NoViableAltException(self)
> > --
> > 2.18.0.windows.1
> >
> >
> >
>
next prev parent reply other threads:[~2020-06-05 5:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 8:48 [PATCH v2 0/5] Add a pipline to check Ecc issues for edk2 on open ci Zhang, Shenglei
2020-06-03 8:48 ` [PATCH v2 1/5] BaseTools:ECC needs to update the contents of CParser4 Zhang, Shenglei
2020-06-05 4:38 ` [edk2-devel] " Yuwei Chen
2020-06-05 5:11 ` Zhang, Shenglei [this message]
2020-06-03 8:48 ` [PATCH v2 2/5] BaseTools/Scripts: Add EccCheck.py Zhang, Shenglei
2020-06-03 8:48 ` [PATCH v2 3/5] pip-requirements.txt: Add Ecc required lib Zhang, Shenglei
2020-06-03 8:48 ` [PATCH v2 4/5] .azurepiplines: Add a pipline to check ECC issues for commits Zhang, Shenglei
2020-06-03 8:48 ` [PATCH v2 5/5] MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check Zhang, Shenglei
2020-06-03 14:27 ` [edk2-devel] [PATCH v2 0/5] Add a pipline to check Ecc issues for edk2 on open ci Laszlo Ersek
2020-06-04 5:38 ` Zhang, Shenglei
2020-06-09 12:24 ` Laszlo Ersek
2020-06-09 13:10 ` Liming Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C0706E73DB8C124D9B9C38AA364E5D5E06098B92@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox