Mercurial > projects > dil
changeset 769:5e3ef1b2011c
Added and improved documentation.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 17 Feb 2008 02:21:55 +0100 |
parents | d84349a60f5c |
children | 26d8ed59806d |
files | trunk/src/dil/Unicode.d trunk/src/dil/ast/DefaultVisitor.d trunk/src/dil/ast/Expression.d trunk/src/dil/ast/Node.d trunk/src/dil/ast/NodesEnum.d trunk/src/dil/ast/Type.d trunk/src/dil/ast/Types.d trunk/src/dil/ast/Visitor.d trunk/src/dil/doc/Doc.d trunk/src/dil/doc/Macro.d trunk/src/dil/doc/Parser.d trunk/src/dil/lexer/Funcs.d trunk/src/dil/lexer/IdTable.d trunk/src/dil/lexer/Identifier.d trunk/src/dil/lexer/IdentsEnum.d trunk/src/dil/lexer/IdentsGenerator.d trunk/src/dil/lexer/Lexer.d trunk/src/dil/parser/Parser.d |
diffstat | 18 files changed, 191 insertions(+), 162 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/dil/Unicode.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/Unicode.d Sun Feb 17 02:21:55 2008 +0100 @@ -11,20 +11,16 @@ /// Invalid character, returned on errors. const dchar ERROR_CHAR = 0xD800; -/++ - Returns true if this character is not a surrogate - code point and not higher than 0x10FFFF. -+/ +/// Returns: true if this character is not a surrogate +/// code point and not higher than 0x10FFFF. bool isValidChar(dchar d) { return d < 0xD800 || d > 0xDFFF && d <= 0x10FFFF; } -/++ - There are a total of 66 noncharacters. - Returns: true if this is one of them. - See_also: Chapter 16.7 Noncharacters in Unicode 5.0 -+/ +/// There are a total of 66 noncharacters. +/// Returns: true if this is one of them. +/// See_also: Chapter 16.7 Noncharacters in Unicode 5.0 bool isNoncharacter(dchar d) { return 0xFDD0 <= d && d <= 0xFDEF || // 32 @@ -222,13 +218,11 @@ } } -/++ - Returns a decoded character from a UTF-16 sequence. - In case of an error in the sequence ERROR_CHAR is returned. - Params: - str = the UTF-16 sequence. - index = where to start from. -+/ +/// Returns a decoded character from a UTF-16 sequence. +/// Returns: ERROR_CHAR in case of an error in the sequence. +/// Params: +/// str = the UTF-16 sequence. +/// index = where to start from. dchar decode(wchar[] str, ref size_t index) { assert(str.length && index < str.length); @@ -254,13 +248,11 @@ return ERROR_CHAR; } -/++ - Returns a decoded character from a UTF-16 sequence. - In case of an error in the sequence ERROR_CHAR is returned. - Params: - p = start of the UTF-16 sequence. - end = one past the end of the sequence. -+/ +/// Returns a decoded character from a UTF-16 sequence. +/// Returns: ERROR_CHAR in case of an error in the sequence. +/// Params: +/// p = start of the UTF-16 sequence. +/// end = one past the end of the sequence. dchar decode(ref wchar* p, wchar* end) { assert(p && p < end);
--- a/trunk/src/dil/ast/DefaultVisitor.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/DefaultVisitor.d Sun Feb 17 02:21:55 2008 +0100 @@ -14,10 +14,8 @@ dil.ast.Parameters; import common; -/++ - This huge template function, when instantiated for a certain node class, - generates a body of visit method calls on the subnodes. -+/ +/// This huge template function, when instantiated for a certain node class, +/// generates a body of calls to visit() on the subnodes. returnType!(T.stringof) visitDefault(T)(T t) { assert(t !is null, "node passed to visitDefault() is null"); @@ -348,13 +346,14 @@ return t; } -/++ - Generate default visit methods. - E.g: - private mixin .visitDefault!(ClassDeclaration) _ClassDeclaration; - override returnType!("ClassDeclaration") visit(ClassDeclaration node) - { return _ClassDeclaration.visitDefault(node); } -+/ +/// Generates the default visit methods. +/// +/// E.g: +/// --- +/// private mixin .visitDefault!(ClassDeclaration) _ClassDeclaration; +/// override returnType!("ClassDeclaration") visit(ClassDeclaration node) +/// { return _ClassDeclaration.visitDefault(node); } +/// --- char[] generateDefaultVisitMethods() { char[] text; @@ -365,9 +364,7 @@ } // pragma(msg, generateDefaultVisitMethods()); -/++ - This class provides default methods for traversing nodes in a syntax tree. -+/ +/// This class provides default methods for traversing nodes in a syntax tree. class DefaultVisitor : Visitor { // Comment out if too many errors are shown.
--- a/trunk/src/dil/ast/Expression.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/Expression.d Sun Feb 17 02:21:55 2008 +0100 @@ -11,7 +11,7 @@ /// The root class of all expressions. abstract class Expression : Node { - Type type; /// The type of this expression. + Type type; /// The semantic type of this expression. this() {
--- a/trunk/src/dil/ast/Node.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/Node.d Sun Feb 17 02:21:55 2008 +0100 @@ -9,16 +9,15 @@ public import dil.lexer.Token; public import dil.ast.NodesEnum; -/// This string is mixed into the constructor of a class that inherits from Node. -const string set_kind = `this.kind = mixin("NodeKind." ~ typeof(this).stringof);`; - -class Node +/// The root class of all nodes that can form a D syntax tree. +abstract class Node { - NodeCategory category; - NodeKind kind; + NodeCategory category; /// The category of this node. + NodeKind kind; /// The kind of this node. Node[] children; // Will be probably removed sometime. - Token* begin, end; + Token* begin, end; /// The begin and end tokens of this node. + /// Constructs a node object. this(NodeCategory category) { assert(category != NodeCategory.Undefined); @@ -65,6 +64,7 @@ children is null || addChildren(children); } + /// Returns a pointer to Class if this node can be cast to it. Class Is(Class)() { if (kind == mixin("NodeKind." ~ typeof(Class).stringof)) @@ -72,8 +72,13 @@ return null; } + /// Casts this node to Class. Class to(Class)() { return cast(Class)cast(void*)this; } } + +/// This string is mixed into the constructor of a class that inherits +/// from Node. It sets the member kind. +const string set_kind = `this.kind = mixin("NodeKind." ~ typeof(this).stringof);`;
--- a/trunk/src/dil/ast/NodesEnum.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/NodesEnum.d Sun Feb 17 02:21:55 2008 +0100 @@ -4,6 +4,7 @@ +/ module dil.ast.NodesEnum; +/// Enumerates the categories of a node. enum NodeCategory : ushort { Undefined, @@ -14,7 +15,7 @@ Other } -/// Array of class names that inherit from Node. +/// A list of all class names that inherit from Node. static const char[][] classNames = [ // Declarations: "CompoundDeclaration", @@ -211,6 +212,7 @@ "TemplateArguments", ]; +/// Generates the members of enum NodeKind. char[] generateNodeKindMembers() { char[] text;
--- a/trunk/src/dil/ast/Type.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/Type.d Sun Feb 17 02:21:55 2008 +0100 @@ -7,10 +7,10 @@ import dil.ast.Node; import dil.semantic.Types; -/// The base class of all type nodes. +/// The root class of all type nodes. abstract class TypeNode : Node { - TypeNode next; + TypeNode next; /// The next type in the type chain. Type type; /// The semantic type of this type node. this() @@ -25,6 +25,7 @@ this.next = next; } + /// Returns the root type of the type chain. TypeNode baseType() { auto type = this;
--- a/trunk/src/dil/ast/Types.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/Types.d Sun Feb 17 02:21:55 2008 +0100 @@ -67,7 +67,8 @@ } } -/// "typeof" "(" Expression ")" +/// "typeof" "(" Expression ")" or$(BR) +/// "typeof" "(" "return" ")" (D2.0) class TypeofType : TypeNode { Expression e; @@ -78,7 +79,7 @@ this.e = e; } - /// D2.0: "typeof" "(" "return" ")" + // For D2.0: "typeof" "(" "return" ")" this() { mixin(set_kind); @@ -114,9 +115,9 @@ } } -/// Dynamic array: T[] or -/// Static array: T[E] or -/// Slice array (for tuples): T[E..E] or +/// Dynamic array: T[] or$(BR) +/// Static array: T[E] or$(BR) +/// Slice array (for tuples): T[E..E] or$(BR) /// Associative array: T[T] class ArrayType : TypeNode {
--- a/trunk/src/dil/ast/Visitor.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/ast/Visitor.d Sun Feb 17 02:21:55 2008 +0100 @@ -11,12 +11,13 @@ dil.ast.Types, dil.ast.Parameters; -/++ - Generate visit methods. - E.g.: - Declaration visit(ClassDeclaration){return null;}; - Expression visit(CommaExpression){return null;}; -+/ +/// Generate visit methods. +/// +/// E.g.: +/// --- +/// Declaration visit(ClassDeclaration){return null;}; +/// Expression visit(CommaExpression){return null;}; +/// --- char[] generateVisitMethods() { char[] text; @@ -44,21 +45,21 @@ alias Node returnType; } -/++ - Generate functions which do the second dispatch.$(BR) - E.g.:$(BR) - $(D_CODE -Expression visitCommaExpression(Visitor visitor, CommaExpression c) -{ visitor.visit(c); }) - - The equivalent in the traditional visitor pattern would be:$(BR) - $(D_CODE -class CommaExpression : Expression -{ - void accept(Visitor visitor) - { visitor.visit(this); } -}) -+/ +/// Generate functions which do the second dispatch. +/// +/// E.g.: +/// --- +/// Expression visitCommaExpression(Visitor visitor, CommaExpression c) +/// { visitor.visit(c); /* Second dispatch. */ } +/// --- +/// The equivalent in the traditional visitor pattern would be: +/// --- +/// class CommaExpression : Expression +/// { +/// void accept(Visitor visitor) +/// { visitor.visit(this); } +/// } +/// --- char[] generateDispatchFunctions() { char[] text; @@ -70,7 +71,14 @@ // pragma(msg, generateDispatchFunctions()); /++ - The vtable holds a list of function pointers to the dispatch functions. + Generates an array of function pointers. + + --- + [ + cast(void*)&visitCommaExpression, + // etc. + ] + --- +/ char[] generateVTable() { @@ -81,7 +89,10 @@ } // pragma(msg, generateVTable()); -/// The visitor pattern. +/// Implements a variation of the visitor pattern. +/// +/// Inherited by classes that need to traverse a D syntax tree +/// and do computations, transformations and other things on it. abstract class Visitor { mixin(generateVisitMethods()); @@ -89,18 +100,19 @@ static mixin(generateDispatchFunctions()); - /// The dispatch table. + /// The table holding function pointers to the second dispatch functions. static const void*[] dispatch_vtable = mixin(generateVTable()); static assert(dispatch_vtable.length == classNames.length, "vtable length doesn't match number of classes"); - // Returns the dispatch function for n. + /// Looks up the second dispatch function for n and returns that. Node function(Visitor, Node) getDispatchFunction()(Node n) { return cast(Node function(Visitor, Node))dispatch_vtable[n.kind]; } + /// The main and first dispatch function. Node dispatch(Node n) - { // Do first dispatch. Second dispatch is done in the called function. + { // Second dispatch is done in the called function. return getDispatchFunction(n)(this, n); }
--- a/trunk/src/dil/doc/Doc.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/doc/Doc.d Sun Feb 17 02:21:55 2008 +0100 @@ -189,7 +189,7 @@ /// Params: /// ident = set to the Identifier /// bodyBegin = set to the beginning of the text body (whitespace skipped.) - /// Returns: true if found + /// Returns: true if found. bool findNextIdColon(ref char[] ident, ref char* bodyBegin) { while (p < textEnd)
--- a/trunk/src/dil/doc/Macro.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/doc/Macro.d Sun Feb 17 02:21:55 2008 +0100 @@ -15,7 +15,7 @@ class Macro { string name; /// The name of the macro. - string text; /// Substitution text. + string text; /// The substitution text. uint callLevel; /// Recursive call level. this (string name, string text) { @@ -99,7 +99,7 @@ return macros; } - /// Scans for a macro invocation. E.g.: $(DDOC) + /// Scans for a macro invocation. E.g.: $(DDOC) /// Returns: a pointer set to one char past the closing parenthesis, /// or null if this isn't a macro invocation. static char* scanMacro(char* p, char* textEnd) @@ -296,11 +296,11 @@ return arg0 ~ args; } - /// Expands "$ +", "$ 0" - "$ 9" with args[n] in text. + /// Expands "$+", "$0" - "$9" with args[n] in text. /// Params: /// text = the text to scan for argument placeholders. /// args = the first element, args[0], is the whole argument string and - /// the following elements are slices into it. + /// the following elements are slices into it.$(BR) /// The array is empty if there are no arguments. char[] expandArguments(char[] text, char[][] args) in { assert(args.length != 1, "zero or more than 1 args expected"); }
--- a/trunk/src/dil/doc/Parser.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/doc/Parser.d Sun Feb 17 02:21:55 2008 +0100 @@ -8,6 +8,7 @@ import dil.Unicode; import common; +/// A pair of strings. class IdentValue { string ident; @@ -23,11 +24,11 @@ /// <pre> /// ident = value /// ident2 = value2 -//// more text +/// more text /// </pre> struct IdentValueParser { - char* p; + char* p; /// Current pointer. char* textEnd; IdentValue[] parse(string text) @@ -73,6 +74,11 @@ return makeString(begin, end); } + /// Finds the next "Identifier =". + /// Params: + /// ident = set to Identifier. + /// bodyBegin = set to the beginning of the text body (whitespace skipped.) + /// Returns: true if found. bool findNextIdent(ref string ident, ref char* bodyBegin) { while (p < textEnd) @@ -119,6 +125,6 @@ char[] makeString(char* begin, char* end) { - assert(begin <= end); + assert(begin && end && begin <= end); return begin[0 .. end - begin]; }
--- a/trunk/src/dil/lexer/Funcs.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/lexer/Funcs.d Sun Feb 17 02:21:55 2008 +0100 @@ -4,63 +4,55 @@ +/ module dil.lexer.Funcs; -const char[3] LS = \u2028; /// Line separator. -const char[3] PS = \u2029; /// Paragraph separator. +const char[3] LS = \u2028; /// Unicode line separator. +const char[3] PS = \u2029; /// Unicode paragraph separator. const dchar LSd = 0x2028; const dchar PSd = 0x2029; static assert(LS[0] == PS[0] && LS[1] == PS[1]); const uint _Z_ = 26; /// Control+Z -/// Returns true if d is a Unicode line or paragraph separator. +/// Returns: true if d is a Unicode line or paragraph separator. bool isUnicodeNewlineChar(dchar d) { return d == LSd || d == PSd; } -/// Returns true if p points to a line or paragraph separator. +/// Returns: true if p points to a line or paragraph separator. bool isUnicodeNewline(char* p) { return *p == LS[0] && p[1] == LS[1] && (p[2] == LS[2] || p[2] == PS[2]); } -/++ - Returns true if p points to the start of a Newline. - Newline: \n | \r | \r\n | LS | PS -+/ +/// Returns: true if p points to the start of a Newline. +/// Newline: \n | \r | \r\n | LS | PS bool isNewline(char* p) { return *p == '\n' || *p == '\r' || isUnicodeNewline(p); } -/// Returns if c is a Newline character. +/// Returns: true if c is a Newline character. bool isNewline(dchar c) { return c == '\n' || c == '\r' || isUnicodeNewlineChar(c); } -/++ - Returns true if p points to an EOF character. - EOF: 0 | _Z_ -+/ +/// Returns: true if p points to an EOF character. +/// EOF: 0 | _Z_ bool isEOF(dchar c) { return c == 0 || c == _Z_; } -/++ - Returns true if p points to the first character of an EndOfLine. - EndOfLine: Newline | EOF -+/ +/// Returns: true if p points to the first character of an EndOfLine. +/// EndOfLine: Newline | EOF bool isEndOfLine(char* p) { return isNewline(p) || isEOF(*p); } -/++ - Scans a Newline and sets p one character past it. - Returns '\n' if scanned or 0 otherwise. -+/ +/// Scans a Newline and sets p one character past it. +/// Returns: '\n' if found or 0 otherwise. dchar scanNewline(ref char* p) { switch (*p) @@ -114,15 +106,25 @@ const uint EVMask = 0xFF00; // Bit mask for escape value private alias CProperty CP; +/// Returns: true if c is an octal digit. int isoctal(char c) { return ptable[c] & CP.Octal; } +/// Returns: true if c is a decimal digit. int isdigit(char c) { return ptable[c] & CP.Digit; } +/// Returns: true if c is a hexadecimal digit. int ishexad(char c) { return ptable[c] & CP.Hex; } +/// Returns: true if c is a letter. int isalpha(char c) { return ptable[c] & CP.Alpha; } +/// Returns: true if c is an alphanumeric. int isalnum(char c) { return ptable[c] & (CP.Alpha | CP.Digit); } +/// Returns: true if c is the beginning of a D identifier (only ASCII.) int isidbeg(char c) { return ptable[c] & (CP.Alpha | CP.Underscore); } +/// Returns: true if c is a D identifier character (only ASCII.) int isident(char c) { return ptable[c] & (CP.Alpha | CP.Underscore | CP.Digit); } +/// Returns: true if c is a whitespace character. int isspace(char c) { return ptable[c] & CP.Whitespace; } +/// Returns: the escape value for c. int char2ev(char c) { return ptable[c] >> 8; /*(ptable[c] & EVMask) >> 8;*/ } +/// Returns: true if c is an ASCII character. int isascii(uint c) { return c < 128; } version(gen_ptable)
--- a/trunk/src/dil/lexer/IdTable.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/lexer/IdTable.d Sun Feb 17 02:21:55 2008 +0100 @@ -12,6 +12,7 @@ public import dil.lexer.Identifier; public import dil.lexer.IdentsEnum; +/// A namespace for the predefined identifiers. struct Ident { const static @@ -25,9 +26,7 @@ } } -/++ - Global table for hoarding and retrieving identifiers. -+/ +/// Global table for hoarding and retrieving identifiers. struct IdTable { static:
--- a/trunk/src/dil/lexer/Identifier.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/lexer/Identifier.d Sun Feb 17 02:21:55 2008 +0100 @@ -8,27 +8,36 @@ import dil.lexer.IdentsEnum; import common; +/// Represents an identifier as defined in the D specs. +/// +///<pre> +/// Identifier := IdStart IdChar* +/// IdStart := "_" | Letter +/// IdChar := Letter | "0"-"9" +/// Letter := UniAlpha +///</pre> +/// Unicode alphas are defined in Unicode 5.0.0. align(1) struct Identifier { - string str; - TOK type; - ID identID; + string str; /// The UTF-8 string of the identifier. + TOK kind; /// The token kind. + IDK idKind; /// Only for predefined identifiers. - static Identifier* opCall(string str, TOK type) + static Identifier* opCall(string str, TOK kind) { auto id = new Identifier; id.str = str; - id.type = type; + id.kind = kind; return id; } - static Identifier* opCall(string str, TOK type, ID identID) + static Identifier* opCall(string str, TOK kind, IDK idKind) { auto id = new Identifier; id.str = str; - id.type = type; - id.identID = identID; + id.kind = kind; + id.idKind = idKind; return id; }
--- a/trunk/src/dil/lexer/IdentsEnum.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/lexer/IdentsEnum.d Sun Feb 17 02:21:55 2008 +0100 @@ -7,7 +7,8 @@ import dil.lexer.IdentsGenerator; mixin( - "enum ID : ushort {" + // Enumerates predefined identifiers. + "enum IDK : ushort {" "Null," ~ generateIDMembers ~ "}"
--- a/trunk/src/dil/lexer/IdentsGenerator.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/lexer/IdentsGenerator.d Sun Feb 17 02:21:55 2008 +0100 @@ -11,6 +11,7 @@ char[] idStr; /// In table. } +/// Array of predefined identifiers. static const StrPair[] identPairs = [ // Predefined version identifiers: {"DigitalMars"}, {"X86"}, {"X86_64"}, @@ -65,11 +66,12 @@ ]; /++ - CTF for generating the members of the struct Ident. - The resulting string could look like this: - --- + CTF for generating the members of the struct Ident. + + The resulting string looks like this: + --- private struct Ids {static const: - Identifier _str = {"str", TOK.Identifier, ID.str}; + Identifier _str = {"str", TOK.Identifier, IDK.str}; // more ... } Identifier* str = &Ids._str; @@ -78,7 +80,7 @@ str, // more ... ] - --- + --- +/ char[] generateIdentMembers() { @@ -90,7 +92,7 @@ { // N.B.: Compiler cries for some reason when trying to access pair.idStr. // Identifier _str = {"str", TOK.Identifier, ID.str}; - private_members ~= "Identifier _"~pair.str~` = {"`~pair.str~`", TOK.Identifier, ID.`~pair.str~"};\n"; + private_members ~= "Identifier _"~pair.str~` = {"`~pair.str~`", TOK.Identifier, IDK.`~pair.str~"};\n"; // Identifier* str = &_str; public_members ~= "Identifier* "~pair.str~" = &Ids._"~pair.str~";\n"; array ~= pair.str~","; @@ -102,7 +104,7 @@ return private_members ~ public_members ~ array; } -/// CTF for generating the members of the enum ID. +/// CTF for generating the members of the enum IDK. char[] generateIDMembers() { char[] members;
--- a/trunk/src/dil/lexer/Lexer.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/lexer/Lexer.d Sun Feb 17 02:21:55 2008 +0100 @@ -304,7 +304,7 @@ t.end = p; auto id = IdTable.lookup(t.srcText); - t.kind = id.type; + t.kind = id.kind; t.ident = id; if (t.kind == TOK.Identifier || t.isKeyword) @@ -1054,7 +1054,7 @@ t.end = p; auto id = IdTable.lookup(t.srcText); - t.kind = id.type; + t.kind = id.kind; t.ident = id; if (t.kind == TOK.Identifier || t.isKeyword)
--- a/trunk/src/dil/parser/Parser.d Sat Feb 16 22:10:21 2008 +0100 +++ b/trunk/src/dil/parser/Parser.d Sun Feb 17 02:21:55 2008 +0100 @@ -707,11 +707,11 @@ auto identTok = requireId(); - ID identID = identTok ? identTok.ident.identID : ID.Null; - - switch (identID) + IDK idKind = identTok ? identTok.ident.idKind : IDK.Null; + + switch (idKind) { - case ID.C: + case IDK.C: if (consumed(T.PlusPlus)) { linkageType = LinkageType.Cpp; @@ -719,16 +719,16 @@ } linkageType = LinkageType.C; break; - case ID.D: + case IDK.D: linkageType = LinkageType.D; break; - case ID.Windows: + case IDK.Windows: linkageType = LinkageType.Windows; break; - case ID.Pascal: + case IDK.Pascal: linkageType = LinkageType.Pascal; break; - case ID.System: + case IDK.System: linkageType = LinkageType.System; break; default: @@ -2156,9 +2156,9 @@ nT(); auto condition = requireIdentifier(MSG.ExpectedScopeIdentifier); if (condition) - switch (condition.identID) + switch (condition.idKind) { - case ID.exit, ID.success, ID.failure: + case IDK.exit, IDK.success, IDK.failure: break; default: error(this.prevToken, MSG.InvalidScopeIdentifier, this.prevToken.srcText); @@ -2569,10 +2569,10 @@ T.Float, T.Double, T.Real: goto LAsmTypePrefix; case T.Identifier: - switch (token.ident.identID) + switch (token.ident.idKind) { - case ID.near, ID.far,/* "byte", "short", "int",*/ - ID.word, ID.dword, ID.qword/*, "float", "double", "real"*/: + case IDK.near, IDK.far,/* "byte", "short", "int",*/ + IDK.word, IDK.dword, IDK.qword/*, "float", "double", "real"*/: LAsmTypePrefix: nT(); if (token.kind == T.Identifier && token.ident is Ident.ptr) @@ -2581,11 +2581,11 @@ error(MID.ExpectedButFound, "ptr", token.srcText); e = new AsmTypeExpression(parseAsmExpression()); break; - case ID.offset: + case IDK.offset: nT(); e = new AsmOffsetExpression(parseAsmExpression()); break; - case ID.seg: + case IDK.seg: nT(); e = new AsmSegExpression(parseAsmExpression()); break; @@ -2652,15 +2652,15 @@ break; case T.Identifier: auto register = token.ident; - switch (register.identID) + switch (register.idKind) { // __LOCAL_SIZE - case ID.__LOCAL_SIZE: + case IDK.__LOCAL_SIZE: nT(); e = new AsmLocalSizeExpression(); break; // Register - case ID.ST: + case IDK.ST: nT(); // (1) - (7) int number = -1; @@ -2674,7 +2674,7 @@ } e = new AsmRegisterExpression(register, number); break; - case ID.FS: + case IDK.FS: nT(); // TODO: is the colon-number part optional? int number = -1; @@ -2688,20 +2688,20 @@ } e = new AsmRegisterExpression(register, number); break; - case ID.AL, ID.AH, ID.AX, ID.EAX, - ID.BL, ID.BH, ID.BX, ID.EBX, - ID.CL, ID.CH, ID.CX, ID.ECX, - ID.DL, ID.DH, ID.DX, ID.EDX, - ID.BP, ID.EBP, ID.SP, ID.ESP, - ID.DI, ID.EDI, ID.SI, ID.ESI, - ID.ES, ID.CS, ID.SS, ID.DS, ID.GS, - ID.CR0, ID.CR2, ID.CR3, ID.CR4, - ID.DR0, ID.DR1, ID.DR2, ID.DR3, ID.DR6, ID.DR7, - ID.TR3, ID.TR4, ID.TR5, ID.TR6, ID.TR7, - ID.MM0, ID.MM1, ID.MM2, ID.MM3, - ID.MM4, ID.MM5, ID.MM6, ID.MM7, - ID.XMM0, ID.XMM1, ID.XMM2, ID.XMM3, - ID.XMM4, ID.XMM5, ID.XMM6, ID.XMM7: + case IDK.AL, IDK.AH, IDK.AX, IDK.EAX, + IDK.BL, IDK.BH, IDK.BX, IDK.EBX, + IDK.CL, IDK.CH, IDK.CX, IDK.ECX, + IDK.DL, IDK.DH, IDK.DX, IDK.EDX, + IDK.BP, IDK.EBP, IDK.SP, IDK.ESP, + IDK.DI, IDK.EDI, IDK.SI, IDK.ESI, + IDK.ES, IDK.CS, IDK.SS, IDK.DS, IDK.GS, + IDK.CR0, IDK.CR2, IDK.CR3, IDK.CR4, + IDK.DR0, IDK.DR1, IDK.DR2, IDK.DR3, IDK.DR6, IDK.DR7, + IDK.TR3, IDK.TR4, IDK.TR5, IDK.TR6, IDK.TR7, + IDK.MM0, IDK.MM1, IDK.MM2, IDK.MM3, + IDK.MM4, IDK.MM5, IDK.MM6, IDK.MM7, + IDK.XMM0, IDK.XMM1, IDK.XMM2, IDK.XMM3, + IDK.XMM4, IDK.XMM5, IDK.XMM6, IDK.XMM7: nT(); e = new AsmRegisterExpression(register); break;