From: Alan Knowles Date: Wed, 9 Sep 2015 09:50:29 +0000 (+0800) Subject: JSDOC/Token.vala X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=commitdiff_plain;h=bfb1fcc565d2fddf4b136f33bb27c2cfb3138407 JSDOC/Token.vala --- diff --git a/JSDOC/Token.vala b/JSDOC/Token.vala index 96a601c..90dbf85 100644 --- a/JSDOC/Token.vala +++ b/JSDOC/Token.vala @@ -27,37 +27,47 @@ * * */ +namespace JSDOC +{ + int tokid = 1; -public class JSDOC.Token : Object { - - public string data; - public string type; - public string name; - public int line; - public string prefix; - - public string outData; - - public string identifier; + public class Token : Object { + + int id; + + public string data; + public string type; + public string name; + public int line; + public string prefix; + + public string outData; + + public string identifier; + + public Token(string data, string type, string name, int line) + { + this.data = data; + this.type = type; + this.name = name; + this.line = line; + this.prefix = ""; + this.outData = null; // used by packer/scopeparser + this.identifier = null; // used by scope + this.id = tokid++; + } - public Token(string data, string type, string name, int line) { - this.data = data; - this.type = type; - this.name = name; - this.line = line; - this.prefix = ""; - this.outData = null; // used by packer/scopeparser - this.identifier = null; // used by scope - this.id = Token.id++; - }, - Object, - { - toString: function() + public string asString() { - return 'line:' + this.line + ', type:' + this.type + - ', name:' + this.name + ', data:' + this.data + - ((this.outData === false) ? '' : ( 'outData : ' + this.outData)); - }, + return "line:%d, type %s, name %s, data : %s , outData: %s".printf( + this.line, + this.type, + this.name, + this.data, + this.outData == null ? "" : this.outData + ) + + } toRaw : function(lvl)