Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return 'close bracket expected'
case jsonParser.ParseErrorCode.ColonExpected:
return 'colon expected'
case jsonParser.ParseErrorCode.CommaExpected:
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
return 'property name expected'
case jsonParser.ParseErrorCode.UnexpectedEndOfComment:
return 'unexpected end of comment'
case jsonParser.ParseErrorCode.UnexpectedEndOfNumber:
return 'unexpected end of number'
case jsonParser.ParseErrorCode.UnexpectedEndOfString:
return 'unexpected end of string'
case jsonParser.ParseErrorCode.ValueExpected:
return 'value expected'
// By omitting the default case, we force the compiler to yell at us
// if any enum members are added/removed/changed.
}
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
return 'property name expected'
case jsonParser.ParseErrorCode.UnexpectedEndOfComment:
return 'unexpected end of comment'
case jsonParser.ParseErrorCode.UnexpectedEndOfNumber:
return 'unexpected end of number'
case jsonParser.ParseErrorCode.UnexpectedEndOfString:
return 'unexpected end of string'
case jsonParser.ParseErrorCode.ValueExpected:
return 'value expected'
// By omitting the default case, we force the compiler to yell at us
// if any enum members are added/removed/changed.
}
}
return 'colon expected'
case jsonParser.ParseErrorCode.CommaExpected:
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
return 'property name expected'
case jsonParser.ParseErrorCode.UnexpectedEndOfComment:
return 'unexpected end of comment'
case jsonParser.ParseErrorCode.UnexpectedEndOfNumber:
return 'unexpected end of number'
case jsonParser.ParseErrorCode.UnexpectedEndOfString:
return 'unexpected end of string'
case jsonParser.ParseErrorCode.ValueExpected:
return 'value expected'
// By omitting the default case, we force the compiler to yell at us
// if any enum members are added/removed/changed.
}
}
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
return 'property name expected'
case jsonParser.ParseErrorCode.UnexpectedEndOfComment:
return 'unexpected end of comment'
case jsonParser.ParseErrorCode.UnexpectedEndOfNumber:
return 'unexpected end of number'
case jsonParser.ParseErrorCode.UnexpectedEndOfString:
return 'unexpected end of string'
case jsonParser.ParseErrorCode.ValueExpected:
return 'value expected'
// By omitting the default case, we force the compiler to yell at us
// if any enum members are added/removed/changed.
}
}
function getParseErrorDescription(code: jsonParser.ParseErrorCode): string {
switch (code) {
case jsonParser.ParseErrorCode.CloseBraceExpected:
return 'close brace expected'
case jsonParser.ParseErrorCode.CloseBracketExpected:
return 'close bracket expected'
case jsonParser.ParseErrorCode.ColonExpected:
return 'colon expected'
case jsonParser.ParseErrorCode.CommaExpected:
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
function getParseErrorDescription(code: jsonParser.ParseErrorCode): string {
switch (code) {
case jsonParser.ParseErrorCode.CloseBraceExpected:
return 'close brace expected'
case jsonParser.ParseErrorCode.CloseBracketExpected:
return 'close bracket expected'
case jsonParser.ParseErrorCode.ColonExpected:
return 'colon expected'
case jsonParser.ParseErrorCode.CommaExpected:
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
function getParseErrorDescription(code: jsonParser.ParseErrorCode): string {
switch (code) {
case jsonParser.ParseErrorCode.CloseBraceExpected:
return 'close brace expected'
case jsonParser.ParseErrorCode.CloseBracketExpected:
return 'close bracket expected'
case jsonParser.ParseErrorCode.ColonExpected:
return 'colon expected'
case jsonParser.ParseErrorCode.CommaExpected:
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
return 'property name expected'
case jsonParser.ParseErrorCode.UnexpectedEndOfComment:
return 'unexpected end of comment'
case jsonParser.ParseErrorCode.UnexpectedEndOfNumber:
switch (code) {
case jsonParser.ParseErrorCode.CloseBraceExpected:
return 'close brace expected'
case jsonParser.ParseErrorCode.CloseBracketExpected:
return 'close bracket expected'
case jsonParser.ParseErrorCode.ColonExpected:
return 'colon expected'
case jsonParser.ParseErrorCode.CommaExpected:
return 'command expected'
case jsonParser.ParseErrorCode.EndOfFileExpected:
return 'end of file expected'
case jsonParser.ParseErrorCode.InvalidCharacter:
return 'invalid character'
case jsonParser.ParseErrorCode.InvalidCommentToken:
return 'invalid comment token'
case jsonParser.ParseErrorCode.InvalidEscapeCharacter:
return 'invalid escape character'
case jsonParser.ParseErrorCode.InvalidNumberFormat:
return 'invalid number format'
case jsonParser.ParseErrorCode.InvalidSymbol:
return 'invalid symbol'
case jsonParser.ParseErrorCode.InvalidUnicode:
return 'invalid unicode'
case jsonParser.ParseErrorCode.PropertyNameExpected:
return 'property name expected'
case jsonParser.ParseErrorCode.UnexpectedEndOfComment:
return 'unexpected end of comment'
case jsonParser.ParseErrorCode.UnexpectedEndOfNumber:
return 'unexpected end of number'
case jsonParser.ParseErrorCode.UnexpectedEndOfString:
return 'unexpected end of string'
case jsonParser.ParseErrorCode.ValueExpected:
return localize("error.valueExpected", "Value expected")
case Json.ParseErrorCode.ColonExpected:
return localize("error.colonExpected", "Colon expected")
case Json.ParseErrorCode.CommaExpected:
return localize("error.commaExpected", "Comma expected")
case Json.ParseErrorCode.CloseBraceExpected:
return localize(
"error.closeBraceExpected",
"Closing brace expected"
)
case Json.ParseErrorCode.CloseBracketExpected:
return localize(
"error.closeBracketExpected",
"Closing bracket expected"
)
case Json.ParseErrorCode.EndOfFileExpected:
return localize("error.endOfFileExpected", "End of file expected")
default:
return ""
}
}
protected printParseErrorCode(code: number | undefined) {
switch (code) {
case parser.ParseErrorCode.InvalidSymbol: return 'InvalidSymbol';
case parser.ParseErrorCode.InvalidNumberFormat: return 'InvalidNumberFormat';
case parser.ParseErrorCode.PropertyNameExpected: return 'PropertyNameExpected';
case parser.ParseErrorCode.ValueExpected: return 'ValueExpected';
case parser.ParseErrorCode.ColonExpected: return 'ColonExpected';
case parser.ParseErrorCode.CommaExpected: return 'CommaExpected';
case parser.ParseErrorCode.CloseBraceExpected: return 'CloseBraceExpected';
case parser.ParseErrorCode.CloseBracketExpected: return 'CloseBracketExpected';
case parser.ParseErrorCode.EndOfFileExpected: return 'EndOfFileExpected';
case parser.ParseErrorCode.InvalidCommentToken: return 'InvalidCommentToken';
case parser.ParseErrorCode.UnexpectedEndOfComment: return 'UnexpectedEndOfComment';
case parser.ParseErrorCode.UnexpectedEndOfString: return 'UnexpectedEndOfString';
case parser.ParseErrorCode.UnexpectedEndOfNumber: return 'UnexpectedEndOfNumber';
case parser.ParseErrorCode.InvalidUnicode: return 'InvalidUnicode';
case parser.ParseErrorCode.InvalidEscapeCharacter: return 'InvalidEscapeCharacter';
case parser.ParseErrorCode.InvalidCharacter: return 'InvalidCharacter';
}
return '';
}