changes_from_133.txt
来自「SRI international 发布的OAA框架软件」· 文本 代码 · 共 1,744 行 · 第 1/5 页
TXT
1,744 行
the #tokclass reference was not expanded (because it wasn't an
#errclass). In effect the reference was ignored.
This has been fixed.
Problem reported by Mike Dimmick (mike dimmick.demon.co.uk).
#283. (Changed in MR23) Option -tmake invoke's parser's tmake
When the string #(...) appears in an action antlr replaces it with
a call to ASTBase::tmake(...) to construct an AST. It is sometimes
useful to change the tmake routine so that it has access to information
in the parser - something which is not possible with a static method
in an application where they may be multiple parsers active.
The antlr option -tmake replaces the call to ASTBase::tmake with a call
to a user supplied tmake routine.
#282. (Changed in MR23) Initialization error for DBG_REFCOUNTTOKEN
When the pre-processor symbol DBG_REFCOUNTTOKEN is defined
incorrect code is generated to initialize ANTLRRefCountToken::ctor and
dtor.
Fix reported by Sven Kuehn (sven sevenkuehn.de).
#281. (Changed in MR23) Addition of -noctor option for Sorcerer
Added a -noctor option to suppress generation of the blank ctor
for users who wish to define their own ctor.
Contributed by Jan Langer (jan langernetz.de).
#280. (Changed in MR23) Syntax error message for EOF token
The EOF token now receives special treatment in syntax error messages
because there is no text matched by the eof token. The token name
of the eof token is used unless it is "@" - in which case the string
"<eof>" is used.
Problem reported by Erwin Achermann (erwin.achermann switzerland.org).
#279. (Changed in MR23) Exception groups
There was a bug in the way that exception groups were attached to
alternatives which caused problems when there was a block contained
in an alternative. For instance, in the following rule;
statement : IF S { ELSE S }
exception ....
;
the exception would be attached to the {...} block instead of the
entire alternative because it was attached, in error, to the last
alternative instead of the last OPEN alternative.
Reported by Ty Mordane (tymordane hotmail.com).
#278. (Changed in MR23) makefile changes
Contributed by Tomasz Babczynski (faster lab05-7.ict.pwr.wroc.pl).
The -cfile option is not absolutely needed: when extension of
source file is one of the well-known C/C++ extensions it is
treated as C/C++ source
The gnu make defines the CXX variable as the default C++ compiler
name, so I added a line to copy this (if defined) to the CCC var.
Added a -sor option: after it any -class command defines the class
name for sorcerer, not for ANTLR. A file extended with .sor is
treated as sorcerer input. Because sorcerer can be called multiple
times, -sor option can be repeated. Any files and classes (one class
per group) after each -sor makes one tree parser.
Not implemented:
1. Generate dependences for user c/c++ files.
2. Support for -sor in c mode not.
I have left the old genmk program in the directory as genmk_old.c.
#277. (Changed in MR23) Change in macro for failed semantic predicates
In the past, a semantic predicate that failed generated a call to
the macro zzfailed_pred:
#ifndef zzfailed_pred
#define zzfailed_pred(_p) \
if (guessing) { \
zzGUESS_FAIL; \
} else { \
something(_p)
}
#endif
If a user wished to use the failed action option for semantic predicates:
rule : <<my_predicate>>? [my_fail_action] A
| ...
the code for my_fail_action would have to contain logic for handling
the guess part of the zzfailed_pred macro. The user should not have
to be aware of the guess logic in writing the fail action.
The zzfailed_pred has been rewritten to have three arguments:
arg 1: the stringized predicate of the semantic predicate
arg 2: 0 => there is no user-defined fail action
1 => there is a user-defined fail action
arg 3: the user-defined fail action (if defined)
otherwise a no-operation
The zzfailed_pred macro is now defined as:
#ifndef zzfailed_pred
#define zzfailed_pred(_p,_hasuseraction,_useraction) \
if (guessing) { \
zzGUESS_FAIL; \
} else { \
zzfailed_pred_action(_p,_hasuseraction,_useraction) \
}
#endif
With zzfailed_pred_action defined as:
#ifndef zzfailed_pred_action
#define zzfailed_pred_action(_p,_hasuseraction,_useraction) \
if (_hasUserAction) { _useraction } else { failedSemanticPredicate(_p); }
#endif
In C++ mode failedSemanticPredicate() is a virtual function.
In C mode the default action is a fprintf statement.
Suggested by Erwin Achermann (erwin.achermann switzerland.org).
#276. (Changed in MR23) Addition of return value initialization syntax
In an attempt to reduce the problems caused by the PURIFY macro I have
added new syntax for initializing the return value of rules and the
antlr option "-nopurify".
A rule with a single return argument:
r1 > [Foo f = expr] :
now generates code that resembles:
Foo r1(void) {
Foo _retv = expr;
...
}
A rule with more than one return argument:
r2 > [Foo f = expr1, Bar b = expr2 ] :
generates code that resembles:
struct _rv1 {
Foo f;
Bar b;
}
_rv1 r2(void) {
struct _rv1 _retv;
_retv.f = expr1;
_retv.b = expr2;
...
}
C++ style comments appearing in the initialization list may cause problems.
#275. (Changed in MR23) Addition of -nopurify option to antlr
A long time ago the PURIFY macro was introduced to initialize
return value arguments and get rid of annying messages from program
that checked for unitialized variables.
This has caused significant annoyance for C++ users that had
classes with virtual functions or non-trivial contructors because
it would zero the object, including the pointer to the virtual
function table. This could be defeated by redefining
the PURIFY macro to be empty, but it was a constant surprise to
new C++ users of pccts.
I would like to remove it, but I fear that some existing programs
depend on it and would break. My temporary solution is to add
an antlr option -nopurify which disables generation of the PURIFY
macro call.
The PURIFY macro should be avoided in favor of the new syntax
for initializing return arguments described in item #275.
To avoid name clash, the PURIFY macro has been renamed PCCTS_PURIFY.
#274. (Changed in MR23) DLexer.cpp renamed to DLexer.h
(Changed in MR23) ATokPtr.cpp renamed to ATokPtrImpl.h
These two files had .cpp extensions but acted like .h files because
there were included in other files. This caused problems for many IDE.
I have renamed them. The ATokPtrImpl.h was necessary because there was
already an ATokPtr.h.
#273. (Changed in MR23) Default win32 library changed to multi-threaded DLL
The model used for building the Win32 debug and release libraries has changed
to multi-threaded DLL.
To make this change in your MSVC 6 project:
Project -> Settings
Select the C++ tab in the right pane of the dialog box
Select "Category: Code Generation"
Under "Use run-time library" select one of the following:
Multi-threaded DLL
Debug Multi-threaded DLL
Suggested by Bill Menees (bill.menees gogallagher.com)
#272. (Changed in MR23) Failed semantic predicate reported via virtual function
In the past, a failed semantic predicated reported the problem via a
macro which used fprintf(). The macro now expands into a call on
the virtual function ANTLRParser::failedSemanticPredicate().
#271. (Changed in MR23) Warning for LT(i), LATEXT(i) in token match actions
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:
r : abc <<action alpha>> D <<action beta>> E;
In this case LT(1) in action alpha will refer to the next token in
the lookahead buffer ("D"), but LT(1) in action beta will refer to
the token matched by D - the preceding token.
A warning has been added for users about this when an action
following a token match contains a reference to LT(1), LA(1), or LATEXT(1).
This behavior should be changed, but it appears in too many programs
now. Another problem, perhaps more significant, is that the obvious
fix (moving the consume() call to before the action) could change the
order in which input is requested and output appears in existing programs.
This problem was reported, along with a fix by Benjamin Mandel
(beny sd.co.il). However, I felt that changing the behavior was too
dangerous for existing code.
#270. (Changed in MR23) Removed static objects from PCCTSAST.cpp
There were some statically allocated objects in PCCTSAST.cpp
These were changed to non-static.
#269. (Changed in MR23) dlg output for initializing static array
The output from dlg contains a construct similar to the
following:
struct XXX {
static const int size;
static int array1[5];
};
const int XXX::size = 4;
int XXX::array1[size+1];
The problem is that although the expression "size+1" used in
the definition of array1 is equal to 5 (the expression used to
declare array), it is not considered equivalent by some compilers.
Reported with fix by Volker H. Simonis (simonis informatik.uni-tuebingen.de)
#268. (Changed in MR23) syn() routine output when k > 1
The syn() routine is supposed to print out the text of the
token causing the syntax error. It appears that it always
used the text from the first lookahead token rather than the
appropriate one. The appropriate one is computed by comparing
the token codes of lookahead token i (for i = 1 to k) with
the FIRST(i) set.
This has been corrected in ANTLRParser::syn().
Reported by Bill Menees (bill.menees gogallagher.com)
#267. (Changed in MR23) AST traversal functions client data argument
The AST traversal functions now take an extra (optional) parameter
which can point to client data:
preorder_action(void* pData = NULL)
preorder_before_action(void* pData = NULL)
preorder_after_action(void* pData = NULL)
**** Warning: this changes the AST signature. ***
**** Be sure to revise your AST functions of the same name ***
Bill Menees (bill.menees gogallagher.com)
#266. (Changed in MR23) virtual function printMessage()
Bill Menees (bill.menees gogallagher.com) has completed the
tedious taks of replacing all calls to fprintf() with calls
to the virtual function printMessage(). For classes which
have a pointer to the parser it forwards the printMessage()
call to the parser's printMessage() routine.
This should make it significanly easier to redirect pccts
error and warning messages.
#265. (Changed in MR23) Remove "labase++" in C++ mode
In C++ mode labase++ is called when a token is matched.
It appears that labase is not used in C++ mode at all, so
this code has been commented out.
#264. (Changed in MR23) Complete rewrite of ParserBlackBox.h
The parser black box (PBlackBox.h) was completely rewritten
by Chris Uzdavinis (chris atdesk.com) to improve its robustness.
#263. (Changed in MR23) -preamble and -preamble_first rescinded
Changes for item #253 have been rescinded.
#262. (Changed in MR23) Crash with -alpha option during traceback
Under some circumstances a -alpha traceback was started at the
"wrong" time. As a result, internal data structures were not
initialized.
Reported by Arpad Beszedes (beszedes inf.u-szeged.hu).
#261. (Changed in MR23) Defer token fetch for C++ mode
Item #216 has been revised to indicate that use of the defer fetch
option (ZZDEFER_FETCH) requires dlg option -i.
#260. (MR22) Raise default lex buffer size from 8,000 to 32,000 bytes.
ZZLEXBUFSIZE is the size (in bytes) of the buffer used by dlg
generated lexers. The default value has been raised to 32,000 and
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?