Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function tokenTypeForString (string, start) {
if (ids.indexOf(string) !== -1) {
return 'LICENSE'
} else if (string === 'AND') {
return 'AND'
} else if (string === 'OR') {
return 'OR'
} else if (string === 'WITH') {
return 'WITH'
} else if (exceptions.indexOf(string) !== -1) {
return 'EXCEPTION'
} else if (LICENSEREF.test(string)) {
return 'LICENSEREF'
} else if (DOCUMENTREF.test(string)) {
return 'DOCUMENTREF'
} else if (string === '(') {
return 'OPEN'
} else if (string === ')') {
return 'CLOSE'
} else if (string === '+') {
return 'PLUS'
} else if (string === ':') {
return 'COLON'
} else {
throw new Error('Invalid input at offset ' + start)
}
function identifier () {
var begin = index
var string = idstring()
if (licenses.indexOf(string) !== -1) {
return {
type: 'LICENSE',
string: string
}
} else if (exceptions.indexOf(string) !== -1) {
return {
type: 'EXCEPTION',
string: string
}
}
index = begin
}