[fpc-devel] rebuilding source form passrc parser token tree
graemeg.lists at gmail.com
Sat Aug 21 18:12:03 CEST 2010
On 21 August 2010 16:54, Michael Van Canneyt wrote:
> Ehm. Are you sure this is about fcl-passrc ?
Yes, but I have to apologize. While creating a test app to show the
problem, I found my problem in my own code. Inserting into my list,
instead of Adding to my list! Dope!!! :-(
My stupid mistake. Sorry for the false alarm.
> Where do you see the token list ? I searched for tokenlist, but didn't
> see it anywhere ? The scanner doesnt produce a list, and the parser is
I maintained my own list of tokens and values, so I can rebuild the
source code later. Here is the bit of code I use to parse the files.
If there is a better way of doing this, please let me know - I'm
rather new to the fcl-passrc code and how to use it.
TPasTokenList is my own class that holds a list of tokens and values
for later usage.
function TPasTokenList.ParseSource(AFileName: string): boolean;
Result := False;
fr := TFileResolver.Create;
pas := TPascalScanner.Create(fr);
token := pas.FetchToken;
until pas.CurToken = tkEOF;
Result := True;
I used this code with a recursive directory scanner. One of my little
test apps take a directory as a parameter, then recursively runs
through files and outputs the source file being parsed and OK or FAIL
if it managed to parse it. A nice and quick way to run the fcl-passrc
parser through it's paces of all the FPC source code, or any of my own
- Graeme -
fpGUI - a cross-platform Free Pascal GUI toolkit
More information about the fpc-devel