1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Add a Category type for the syntactic categories in a grammar under TSNode.

This commit is contained in:
Rob Rix 2015-10-28 14:13:41 -04:00
parent 173eb068a1
commit c5685aa586

View File

@ -9,6 +9,29 @@ func readFile(path: String) -> String? {
typealias Term = Cofree<String, Range<Int>>
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) }