本文整理匯總了TypeScript中pegjs-builder/lib/peg/patterns.anyOf函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript anyOf函數的具體用法?TypeScript anyOf怎麽用?TypeScript anyOf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了anyOf函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: sequence
import {chunk,any,rangeOf,anyOf,subRule,zeroOrMore,oneOrMore,optional,sequence,label, gather} from 'pegjs-builder/lib/peg/patterns'
export = {
isToken: true,
isIgnore: false,
name: 'keyword',
body: [
sequence(
oneOrMore(anyOf(
rangeOf('a', 'z'),
rangeOf('A', 'Z'),
rangeOf('0', '9'),
chunk('_')
)),
zeroOrMore(gather(sequence(
chunk(' '),
oneOrMore(anyOf(
rangeOf('a', 'z'),
rangeOf('A', 'Z'),
rangeOf('0', '9'),
chunk('_')
)))
))
)
]
}
示例2: zeroOrMore
import {chunk,any,rangeOf,anyOf,subRule,zeroOrMore,oneOrMore,optional,sequence,label} from 'pegjs-builder/lib/peg/patterns'
// [ \t\r\n]*
export = {
isToken: true,
isIgnore: true,
name: 'whitespace',
body: [
zeroOrMore(anyOf(
chunk(' \t\r\n')
))
]
}
示例3: sequence
import {chunk,any,rangeOf,anyOf,subRule,zeroOrMore,oneOrMore,optional,sequence,label} from 'pegjs-builder/lib/peg/patterns'
// ' ' ' ' [ \t]*
// '\t' [ \t]*
export = {
isToken: true,
isIgnore: false,
name: 'seperator',
body: [
sequence(
chunk(' '),
chunk(' '),
zeroOrMore(anyOf(
chunk(' \t')
))
),
sequence(
chunk('\t'),
zeroOrMore(anyOf(
chunk(' \t')
))
)
]
}
示例4: sequence
import {chunk,any,rangeOf,anyOf,subRule,zeroOrMore,oneOrMore,optional,sequence,label} from 'pegjs-builder/lib/peg/patterns'
// [a-zA-Z_][a-zA-Z0-9_ ]*
export = {
isToken: true,
isIgnore: false,
name: 'argument',
body: [
sequence(
anyOf(
rangeOf('a', 'z'),
rangeOf('A', 'Z'),
chunk('_')
),
oneOrMore(anyOf(
rangeOf('a', 'z'),
rangeOf('A', 'Z'),
rangeOf('0', '9'),
chunk('_') // todo, argument不能包含空格嗎?
))
)
]
}