xref: /aosp_15_r20/external/antlr/runtime/C/doxygen/changes31.dox (revision 16467b971bd3e2009fad32dd79016f2c7e421deb)
1*16467b97STreehugger Robot/// \page changes31 Changes in 3.1 from 3.0
2*16467b97STreehugger Robot///
3*16467b97STreehugger Robot/// The following changes have taken place from 3.0 to 3.1. Some of
4*16467b97STreehugger Robot/// them may require minor changes to your grammar files or the
5*16467b97STreehugger Robot/// programs that invoke your grammar. Please take the time to read
6*16467b97STreehugger Robot/// through this list as it may save you time later.
7*16467b97STreehugger Robot///
8*16467b97STreehugger Robot/// \section returns Constructor Return Values
9*16467b97STreehugger Robot///
10*16467b97STreehugger Robot/// In previous releases the return value from both the generated constructors and
11*16467b97STreehugger Robot/// built in constructor functions would return a value of -1 or -2 if a problem
12*16467b97STreehugger Robot/// occurred. However, the only problem that can really occur is lack of memory,
13*16467b97STreehugger Robot/// hence to avoid the remote change that some memory allocation scheme would return
14*16467b97STreehugger Robot/// an address of -1 for a pointer, the return address is now NULL if there was
15*16467b97STreehugger Robot/// no memory available. The old macros for this mechanism have been removed which
16*16467b97STreehugger Robot/// will force you to read this information. You now need only check the return
17*16467b97STreehugger Robot/// address for NULL, or you could not bother doing that and join with 95% of the world's
18*16467b97STreehugger Robot/// C code.
19*16467b97STreehugger Robot///
20*16467b97STreehugger Robot/// \section trees Tree Parser Rewrites
21*16467b97STreehugger Robot///
22*16467b97STreehugger Robot/// The 3.1 runtime now supports tree rewrites from tree parsers. See the main ANTLR
23*16467b97STreehugger Robot/// documentation for more details. This beta version contains \subpage knownissues regarding
24*16467b97STreehugger Robot/// the release of mmeory allocated to tree nodes when they are rewritten in some combinations
25*16467b97STreehugger Robot/// of re-writing tree parsers. These issues will be corrected before release.
26*16467b97STreehugger Robot///
27*16467b97STreehugger Robot/// \section debugger ANTLRWorks Debugger
28*16467b97STreehugger Robot///
29*16467b97STreehugger Robot/// The ANTLRWorks debugger is now fully supported by this version of the runtime. It
30*16467b97STreehugger Robot/// supports remote debugging only (you cannot generate C, compile and debug it from the
31*16467b97STreehugger Robot/// ANTLRWorks IDE.) However both parser and tree parser debugging is supported providing
32*16467b97STreehugger Robot/// you are using a version of ANTLRWorks that supports tree parser debugging. Generate
33*16467b97STreehugger Robot/// the C code with the -debug option of the ANTLR tool, as per any other target.
34*16467b97STreehugger Robot///
35*16467b97STreehugger Robot/// Note that when you invoke your debugging version of the parser, it will appear to hang
36*16467b97STreehugger Robot/// but is in fact waiting on a local TCP socket connection from the ANTLRWorks debugger. As the
37*16467b97STreehugger Robot/// target environment is unknown, it is not prudent to generate notification status messages
38*16467b97STreehugger Robot/// using something like printf, as the target environment may not have a console or implement
39*16467b97STreehugger Robot/// printf.
40*16467b97STreehugger Robot///
41*16467b97STreehugger Robot/// \section macros Macro Changes
42*16467b97STreehugger Robot///
43*16467b97STreehugger Robot/// Prior to the 3.1 release, accessing the token source of a lexer required knowledge of where
44*16467b97STreehugger Robot/// the token source pointer was located wihtin the lexer. In 3.1, the token source was burried
45*16467b97STreehugger Robot/// further in the innards of the C runtime and such knowledge is considerd irreleavant and confusing.
46*16467b97STreehugger Robot/// Hence, when creating a token stream from a token source, it is now mandatory to use the new
47*16467b97STreehugger Robot/// C macro TOKENSOURCE(lxr), which will expand to point at the token source interface. This MACRO
48*16467b97STreehugger Robot/// will be maintained across future versions. You can see how to use it in the downloadable
49*16467b97STreehugger Robot/// examples, avaiable from the downloads page of the ANTLR web site. Here is the relevant code
50*16467b97STreehugger Robot/// for creating a token stream, extracted from those examples:
51*16467b97STreehugger Robot///
52*16467b97STreehugger Robot/// \code
53*16467b97STreehugger Robot/// tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr));
54*16467b97STreehugger Robot/// \endcode
55*16467b97STreehugger Robot///
56*16467b97STreehugger Robot
57