X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FTokenReader.vala;h=9f2c12d344168a3992691963dca6ecb8ddde7eb3;hp=afa405bc5daa909cfbdf96e58077d1c122a734b3;hb=HEAD;hpb=a89e867560fff4ec2778ee42f15d5758be81d4e9 diff --git a/JSDOC/TokenReader.vala b/JSDOC/TokenReader.vala index afa405b..9f2c12d 100644 --- a/JSDOC/TokenReader.vala +++ b/JSDOC/TokenReader.vala @@ -2,32 +2,14 @@ // test code - -void main() { - var tr = new JSDOC.TokenReader(); - tr.keepDocs =true; - tr.keepWhite = true; - tr.keepComments = true; - tr.sepIdents = true; - tr.collapseWhite = false; - tr.filename = "test"; - string str; - FileUtils.get_contents("/home/alan/gitlive/gnome.introspection-doc-generator/JSDOC/Walker2.js", out str); - - var toks = tr.tokenize(new JSDOC.TextStream(str)); // dont merge xxx + . + yyyy etc. - toks.dump(); -} - + //const Token = imports.Token.Token; //const Lang = imports.Lang.Lang; /** @class Search a {@link JSDOC.TextStream} for language tokens. */ - - - - + namespace JSDOC { public class TokenArray: Object { @@ -73,7 +55,7 @@ namespace JSDOC { public void dump() { foreach(var token in this.tokens) { - print(token.asString()); + print(token.asString() +"\n"); } } @@ -277,7 +259,12 @@ namespace JSDOC { { string found = ""; - while (!stream.lookEOF() && Lang.punc(found + stream.look().to_string()).length > 0) { + while (!stream.lookEOF()) { + var ns = stream.look().to_string(); + + if (null == Lang.punc(found + ns )) { + break; + } found += stream.next(); } @@ -415,12 +402,16 @@ namespace JSDOC { (stream.look() == '<' && stream.look(1) == '!' && stream.look(2) == '-' && stream.look(3) == '-' && (""!=(found=stream.next(4)))) ) { var line = this.line; - while (!stream.lookEOF() && !Lang.isNewline(stream.look().to_string())) { + while (!stream.lookEOF()) { + //print(stream.look().to_string()); + if ( Lang.isNewline(stream.look().to_string())) { + break; + } found += stream.next(); } - //if (!stream.lookEOF()) { // what? << eat the EOL? + if (!stream.lookEOF()) { // lookinng for end of line... if we got it, then do not eat the character.. found += stream.next(); - //} + } if (this.keepComments) { tokens.push(new Token(found, "COMM", "SINGLE_LINE_COMM", line)); }