From c5685aa586443a836278d6b08754b615546ae016 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 28 Oct 2015 14:13:41 -0400 Subject: [PATCH] Add a Category type for the syntactic categories in a grammar under `TSNode`. --- prototype/doubt-difftool/main.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index d473c045a..acb2e01e0 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -9,6 +9,29 @@ func readFile(path: String) -> String? { typealias Term = Cofree> +enum Category: String { + case Arguments = "arguments" + case Assignment = "assignment" + case Comment = "comment" + case ExpressionStatement = "expression_statement" + case FormalParameters = "formal_parameters" + case Function = "function" + case FunctionCall = "function_call" + case Identifier = "identifier" + case IfStatement = "if_statement" + case MemberAccess = "member_access" + case NewExpression = "new_expression" + case NullLiteral = "null" + case Object = "object" + case Pair = "pair" + case Program = "program" + case RelationalOperator = "rel_op" + case ReturnStatement = "return_statement" + case StatementBlock = "statement_block" + case StringLiteral = "string" + case SubscriptAccess = "subscript_access" +} + func termWithInput(string: String) -> Term? { let document = ts_document_make() defer { ts_document_free(document) }