[vala/staging] libvaladoc: Use Scanner.get_identifier_or_keyword() instead of outdated copy
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] libvaladoc: Use Scanner.get_identifier_or_keyword() instead of outdated copy
- Date: Fri, 16 Nov 2018 07:12:34 +0000 (UTC)
commit 0ef28b29b8b543e196963a1b50ac74b59d5ba909
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Nov 15 22:44:46 2018 +0100
libvaladoc: Use Scanner.get_identifier_or_keyword() instead of outdated copy
libvaladoc/api/node.vala | 350 +----------------------------------------------
1 file changed, 1 insertion(+), 349 deletions(-)
---
diff --git a/libvaladoc/api/node.vala b/libvaladoc/api/node.vala
index dfd4a94f3..7e92206f5 100644
--- a/libvaladoc/api/node.vala
+++ b/libvaladoc/api/node.vala
@@ -56,7 +56,7 @@ public abstract class Valadoc.Api.Node : Item, Browsable, Documentation {
per_name_children = new Vala.HashMap<string, Node> (str_hash, str_equal);
per_type_children = new Vala.HashMap<NodeType, Vala.List<Node>> ();
- if (name != null && (is_keyword (name) || name[0].isdigit ())) {
+ if (name != null && (Vala.Scanner.get_identifier_or_keyword (name, name.length) !=
Vala.TokenType.IDENTIFIER || name[0].isdigit ())) {
this.name = "@" + name;
} else {
this.name = name;
@@ -371,353 +371,5 @@ public abstract class Valadoc.Api.Node : Item, Browsable, Documentation {
public int compare_to (Node node) {
return strcmp (name, node.name);
}
-
- private bool is_keyword (string name) {
- switch (name[0]) {
- case 'a':
- switch (name[1]) {
- case 'b':
- return name == "abstract";
-
- case 's':
- if (name[2] == '\0') {
- return true;
- }
-
- return name == "async";
- }
- break;
-
- case 'b':
- switch (name[1]) {
- case 'a':
- return name == "base";
-
- case 'r':
- return name == "break";
- }
- break;
-
- case 'c':
- switch (name[1]) {
- case 'a':
- switch (name[2]) {
- case 's':
- return name == "case";
-
- case 't':
- return name == "catch";
- }
- break;
-
- case 'l':
- return name == "class";
-
- case 'o':
- if (name[2] != 'n') {
- return false;
- }
-
- switch (name[3]) {
- case 's':
- if (name[4] == 't') {
- switch (name[5]) {
- case '\0':
- return true;
-
- case 'r':
- return name == "construct";
- }
- }
- break;
-
- case 't':
- return name == "continue";
- }
- break;
- }
- break;
-
- case 'd':
- switch (name[1]) {
- case 'e':
- switch (name[2]) {
- case 'f':
- return name == "default";
-
- case 'l':
- if (name[3] != 'e') {
- return false;
- }
-
- switch (name[4]) {
- case 'g':
- return name == "delegate";
-
- case 't':
- return name == "delete";
- }
- break;
- }
- break;
-
- case 'o':
- return name[2] == '\0';
-
- case 'y':
- return name == "dynamic";
- }
- break;
-
- case 'e':
- switch (name[1]) {
- case 'l':
- return name == "else";
-
- case 'n':
- switch (name[2]) {
- case 's':
- return name == "ensures";
-
- case 'u':
- return name == "enum";
- }
- break;
-
- case 'r':
- return name == "errordomain";
-
- case 'x':
- return name == "extern";
- }
- break;
-
- case 'f':
- switch (name[1]) {
- case 'a':
- return name == "false";
-
- case 'i':
- return name == "finally";
-
- case 'o':
- if (name[2] != 'r') {
- return false;
- }
-
- switch (name[3]) {
- case '\0':
- return true;
-
- case 'e':
- return name == "foreach";
- }
- break;
- }
- break;
-
- case 'g':
- return name == "get";
-
- case 'i':
- switch (name[1]) {
- case 'f':
- return name[2] == '\0';
-
- case 'n':
- switch (name[2]) {
- case '\0':
- return true;
-
- case 'l':
- return name == "inline";
-
- case 't':
- return name == "interface" || name == "internal";
- }
- break;
-
- case 's':
- return name[2] == '\0';
- }
- break;
-
- case 'l':
- return name == "lock";
-
- case 'n':
- switch (name[1]) {
- case 'a':
- return name == "namespace";
-
- case 'e':
- return name == "new";
-
- case 'u':
- return name == "null";
- }
- break;
-
- case 'o':
- switch (name[1]) {
- case 'u':
- return name == "out";
-
- case 'v':
- return name == "override";
-
- case 'w':
- return name == "owned";
- }
- break;
-
- case 'p':
- switch (name[1]) {
- case 'a':
- return name == "params";
-
- case 'r':
- switch (name[2]) {
- case 'i':
- return name == "private";
-
- case 'o':
- return name == "protected";
- }
- break;
- case 'u':
- return name == "public";
- }
- break;
-
- case 'r':
- if (name[1] != 'e') {
- return false;
- }
-
- switch (name[2]) {
- case 'f':
- return name[3] == '\0';
-
- case 'q':
- return name == "requires";
-
- case 't':
- return name == "return";
- }
- break;
-
- case 's':
- switch (name[1]) {
- case 'e':
- switch (name[2]) {
- case 'a':
- return name == "sealed";
-
- case 't':
- return name[3] == '\0';
- }
- break;
-
- case 'i':
- switch (name[2]) {
- case 'g':
- return name == "signal";
- case 'z':
- return name == "sizeof";
- }
- break;
-
- case 't':
- switch (name[2]) {
- case 'a':
- return name == "static";
-
- case 'r':
- return name == "struct";
- }
- break;
-
- case 'w':
- return name == "switch";
- }
- break;
-
- case 't':
- switch (name[1]) {
- case 'h':
- switch (name[2]) {
- case 'i':
- return name == "this";
-
- case 'r':
- if (name[3] == 'o' && name[4] == 'w') {
- return name[5] == '\0' || (name[5] == 's' && name[6] == '\0');
- }
- break;
- }
- break;
-
- case 'r':
- switch (name[2]) {
- case 'u':
- return name == "true";
-
- case 'y':
- return name[3] == '\0';
- }
- break;
-
- case 'y':
- return name == "typeof";
- }
- break;
-
- case 'u':
- switch (name[1]) {
- case 'n':
- return name == "unowned";
-
- case 's':
- return name == "using";
- }
- break;
-
- case 'v':
- switch (name[1]) {
- case 'a':
- return name == "var";
-
- case 'i':
- return name == "virtual";
-
- case 'o':
- switch (name[2]) {
- case 'i':
- return name == "void";
-
- case 'l':
- return name == "volatile";
- }
- break;
- }
- break;
-
- case 'w':
- switch (name[1]) {
- case 'e':
- return name == "weak";
-
- case 'h':
- return name == "while";
- }
- break;
-
- case 'y':
- return name == "yield";
- }
-
- return false;
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]