From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.4524.1591333871297738909 for ; Thu, 04 Jun 2020 22:11:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: shenglei.zhang@intel.com) IronPort-SDR: aR2BI7YXMuwdZmlBoNGUIG3hpiyM929PwG6omQopk+iYV6bqrxBG91cncET2TpO9X8DMTwleGq NoZ81/GcKjaQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2020 22:11:07 -0700 IronPort-SDR: Ae6tD4nKlkcMJwU8769YuX3D4+bW1e5q6BMh3uQGiDxHEHa2eXO3Qp4hJ9HTo3/u/mimhR/ahF kmP54zfWz3CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,475,1583222400"; d="scan'208";a="257930872" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 04 Jun 2020 22:11:06 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jun 2020 22:11:06 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jun 2020 22:11:05 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.161]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.208]) with mapi id 14.03.0439.000; Fri, 5 Jun 2020 13:11:02 +0800 From: "Zhang, Shenglei" To: "Chen, Yuwei" , "devel@edk2.groups.io" , "Fan, ZhijuX" CC: "Feng, Bob C" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update the contents of CParser4 Thread-Topic: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update the contents of CParser4 Thread-Index: AQHWOYPHYHs4s4NNgkae+ZYaDN3ytajJaROAgAARyvA= Date: Fri, 5 Jun 2020 05:11:01 +0000 Message-ID: References: <20200603084807.24484-1-shenglei.zhang@intel.com> <20200603084807.24484-2-shenglei.zhang@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: shenglei.zhang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yuwei, I'm also not familiar with that. I attached this patch in patch series bec= ause 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 > Cc: Fan, ZhijuX ; Feng, Bob C > ; Gao, Liming > Subject: RE: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update t= he > contents of CParser4 >=20 > Hi, Shenglei >=20 > Since the input arguments number of the getText() function changed, the > build failed. May be you should check about the getText() function's inp= ut. > While how to choose the CParser4 and CParser3, I am not familiar with it= , > would you like to explain for me? >=20 > Thanks, > Yuwei > > -----Original Message----- > > From: 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 ; Feng, Bob C > > ; Gao, Liming > > Subject: [edk2-devel] [PATCH v2 1/5] BaseTools:ECC needs to update the > > contents of CParser4 > > > > From: "Fan, Zhiju" > > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2676 > > > > Because Ecc relies on the antlr extension package, When the antlr vers= ion 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 prev= ious > > versions will have errors.This can be resolved by installing the antlr= 4.8 > version. > > Installation method: pip install antlr4-python3-runtime=3D=3D4.8 > > > > This patch is going to fixed this issue > > > > Cc: Bob Feng > > Cc: Liming Gao > > Signed-off-by: Zhiju.Fan > > --- > > .../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=3D sys.stdout Type: TextIO > > def __init__(self,input=3DNone,output=3D sys.stdout): > > super().__init__(input, output) > > - self.checkVersion("4.7.1") > > + self.checkVersion("4.8") > > self._interp =3D LexerATNSimulator(self, self.atn, self.decis= ionsToDFA, > > PredictionContextCache()) > > self._actions =3D None > > self._predicates =3D 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=3D sys.stdout Type: TextIO > > def __init__(self,input,output=3D sys.stdout): > > super().__init__(input, output) > > - self.checkVersion("4.7.1") > > + self.checkVersion("4.8") > > self._interp =3D ParserATNSimulator(self, self.atn, self.deci= sionsToDFA, > > self.sharedContextCache) > > self._predicates =3D None > > > > @@ -1062,10 +1064,10 @@ class CParser ( Parser ): > > > > > > if localctx.d !=3D None: > > - ModifierText =3D (None if localctx._declaration_speci= fiers is None > else > > > self._input.getText((localctx._declaration_specifiers.start,localctx._de= clarati > > on_specifiers.stop))) > > + ModifierText =3D (None if > > + localctx._declaration_specifiers is None else > > + self._input.getText(localctx._declaration_specifiers.start,localctx.= _d > > + eclaration_specifiers.stop)) > > else: > > ModifierText =3D '' > > - DeclText =3D (None if localctx._declarator is None else > > self._input.getText((localctx._declarator.start,localctx._declarator.s= top))) > > + DeclText =3D (None if localctx._declarator is None else > > + self._input.getText(localctx._declarator.start,localctx._declarator.= st > > + op)) > > DeclLine =3D (None if localctx._declarator is None else > > localctx._declarator.start).line > > DeclOffset =3D (None if localctx._declarator is None else > > localctx._declarator.start).column > > if localctx.a !=3D None: > > @@ -1245,9 +1247,9 @@ class CParser ( Parser ): > > localctx.d =3D self.match(CParser.T__1) > > > > if localctx.b is not None: > > - self.StoreTypedefDefinition(localctx.a.line, loca= lctx.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))), (N= one 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, loca= lctx.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 =3D 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.st= art).column, > > (None if localctx.t is None else localctx.t.start).line, (None if loca= lctx.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 loc= alctx.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 els= e > > + 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 =3D 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.st= art).column, > > (None if localctx.s is None else localctx.s.stop).line, (None if local= ctx.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 els= e > > + 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 =3D 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 local= ctx.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 els= e > > + 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 =3D 569 > > localctx.p =3D self.primary_expression() > > - self.FuncCallText +=3D (None if localctx.p is None else > > self._input.getText((localctx.p.start,localctx.p.stop))) > > + self.FuncCallText +=3D (None if localctx.p is None else > > + self._input.getText(localctx.p.start,localctx.p.stop)) > > self.state =3D 600 > > self._errHandler.sync(self) > > _alt =3D self._interp.adaptivePredict(self._input,73,self= ._ctx) > > @@ -4055,7 +4057,7 @@ class CParser ( Parser ): > > localctx.c =3D self.argument_expression_list(= ) > > self.state =3D 580 > > localctx.b =3D 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 els= e > > + 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_ =3D=3D 4: > > @@ -4770,7 +4772,7 @@ class CParser ( Parser ): > > self.match(CParser.T__22) > > self.state =3D 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 local= ctx.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 =3D self.expression() > > self.state =3D 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 local= ctx.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 =3D 847 > > self.statement() > > self.state =3D 850 > > @@ -6144,7 +6146,7 @@ class CParser ( Parser ): > > self.match(CParser.T__38) > > self.state =3D 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 local= ctx.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 =3D 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 local= ctx.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 > > > > > >=20 >=20