swift Token实用程序用于遗忘语言
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift Token实用程序用于遗忘语言相关的知识,希望对你有一定的参考价值。
//
// Created by Joshua Weinstein on 2/26/16.
// Copyright (c) 2016 Joshua Weinstein. All rights reserved.
//
import Foundation
//file for implementing token utility functions
struct TokenPatterns {
static let alltokens = "\\`[^`]*\\`|[a-zA-Z]+|[0-9]|[1-9][0-9]*|<<|\\<-|\\+|\\-|\\*|\\[|\\]|\\/|;|,|\\.|\\^|_|\\&|@| "
static let allopers = "<<|\\<-|\\+|\\-|\\*|\\[|\\]|\\/|\\^|_|@|,"
}
struct OperTokens {
static let all = Set("+ - * / ^ _ << <- & @".componentsSeparatedByString(" "))
static let list = Set("<+ -> ! ~".componentsSeparatedByString(" "))
static let comparison = Set("== != >= <= > < &=".componentsSeparatedByString(" "))
static let bool = Set("and or not".componentsSeparatedByString(" "))
static let chain = Set("all any".componentsSeparatedByString(" "))
static let containers = Set("[ ] ( ) ; ;".componentsSeparatedByString(" "))
static let declare = Set("@ # $".componentsSeparatedByString(" "))
}
struct CharLib {
//static sets to check for patterns without regex
static let intset = Set("0123456789".characters)
static let letterset = Set("abcdefghijklmnopqrstuvwxyz".characters)
static let doubleset = Set("0123456789.".characters)
static let containerset = Set("[]{}()<>".characters)
}
以上是关于swift Token实用程序用于遗忘语言的主要内容,如果未能解决你的问题,请参考以下文章
swift 遗忘函数语言的遗产值enum
swift 遗忘语言的标准库进展
swift 遗忘语言的旧词法分子,
swift 用于正则表达式的Swift实用程序类
swift 遗忘的旧汇编
swift swmat中遗忘vm的自动模型