mirror of
https://github.com/alecthomas/chroma.git
synced 2025-01-12 01:22:30 +02:00
4d11870090
This resolves a particular issue with parsing YAML multiline, for example: ```yaml a: | multiline literal line 2 ``` The regex used would capture the amount of indentation in the third capture group and then use that as a kind of "status" to know which lines are part of the indented multiline. However, because its a captured group it has to be assigned a token which was `TextWhitespace`. This meant that the indentation was outputted after the multiline, technically it should be seen as an non-captured group, but then its no longer to refer to it in the regex. Therefore I've gone with the solution to add a new token, Ignore, which will not be emitted as a token in the iterator, which can safely be used to make use of capture groups but not have them show up in the output. ## Before ![image](https://github.com/user-attachments/assets/c29353c5-9e15-4f14-a733-57a60fb51910) ## After ![image](https://github.com/user-attachments/assets/57b5d129-a9d3-4b84-ae1f-dc05182b9ad3)
584 lines
24 KiB
Go
584 lines
24 KiB
Go
// Code generated by "enumer -text -type TokenType"; DO NOT EDIT.
|
|
|
|
package chroma
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const _TokenTypeName = "IgnoreNoneOtherErrorCodeLineLineLinkLineTableTDLineTableLineHighlightLineNumbersTableLineNumbersLinePreWrapperBackgroundEOFTypeKeywordKeywordConstantKeywordDeclarationKeywordNamespaceKeywordPseudoKeywordReservedKeywordTypeNameNameAttributeNameBuiltinNameBuiltinPseudoNameClassNameConstantNameDecoratorNameEntityNameExceptionNameFunctionNameFunctionMagicNameKeywordNameLabelNameNamespaceNameOperatorNameOtherNamePseudoNamePropertyNameTagNameVariableNameVariableAnonymousNameVariableClassNameVariableGlobalNameVariableInstanceNameVariableMagicLiteralLiteralDateLiteralOtherLiteralStringLiteralStringAffixLiteralStringAtomLiteralStringBacktickLiteralStringBooleanLiteralStringCharLiteralStringDelimiterLiteralStringDocLiteralStringDoubleLiteralStringEscapeLiteralStringHeredocLiteralStringInterpolLiteralStringNameLiteralStringOtherLiteralStringRegexLiteralStringSingleLiteralStringSymbolLiteralNumberLiteralNumberBinLiteralNumberFloatLiteralNumberHexLiteralNumberIntegerLiteralNumberIntegerLongLiteralNumberOctLiteralNumberByteOperatorOperatorWordPunctuationCommentCommentHashbangCommentMultilineCommentSingleCommentSpecialCommentPreprocCommentPreprocFileGenericGenericDeletedGenericEmphGenericErrorGenericHeadingGenericInsertedGenericOutputGenericPromptGenericStrongGenericSubheadingGenericTracebackGenericUnderlineTextTextWhitespaceTextSymbolTextPunctuation"
|
|
const _TokenTypeLowerName = "ignorenoneothererrorcodelinelinelinklinetabletdlinetablelinehighlightlinenumberstablelinenumberslineprewrapperbackgroundeoftypekeywordkeywordconstantkeyworddeclarationkeywordnamespacekeywordpseudokeywordreservedkeywordtypenamenameattributenamebuiltinnamebuiltinpseudonameclassnameconstantnamedecoratornameentitynameexceptionnamefunctionnamefunctionmagicnamekeywordnamelabelnamenamespacenameoperatornameothernamepseudonamepropertynametagnamevariablenamevariableanonymousnamevariableclassnamevariableglobalnamevariableinstancenamevariablemagicliteralliteraldateliteralotherliteralstringliteralstringaffixliteralstringatomliteralstringbacktickliteralstringbooleanliteralstringcharliteralstringdelimiterliteralstringdocliteralstringdoubleliteralstringescapeliteralstringheredocliteralstringinterpolliteralstringnameliteralstringotherliteralstringregexliteralstringsingleliteralstringsymbolliteralnumberliteralnumberbinliteralnumberfloatliteralnumberhexliteralnumberintegerliteralnumberintegerlongliteralnumberoctliteralnumberbyteoperatoroperatorwordpunctuationcommentcommenthashbangcommentmultilinecommentsinglecommentspecialcommentpreproccommentpreprocfilegenericgenericdeletedgenericemphgenericerrorgenericheadinggenericinsertedgenericoutputgenericpromptgenericstronggenericsubheadinggenerictracebackgenericunderlinetexttextwhitespacetextsymboltextpunctuation"
|
|
|
|
var _TokenTypeMap = map[TokenType]string{
|
|
-14: _TokenTypeName[0:6],
|
|
-13: _TokenTypeName[6:10],
|
|
-12: _TokenTypeName[10:15],
|
|
-11: _TokenTypeName[15:20],
|
|
-10: _TokenTypeName[20:28],
|
|
-9: _TokenTypeName[28:36],
|
|
-8: _TokenTypeName[36:47],
|
|
-7: _TokenTypeName[47:56],
|
|
-6: _TokenTypeName[56:69],
|
|
-5: _TokenTypeName[69:85],
|
|
-4: _TokenTypeName[85:96],
|
|
-3: _TokenTypeName[96:100],
|
|
-2: _TokenTypeName[100:110],
|
|
-1: _TokenTypeName[110:120],
|
|
0: _TokenTypeName[120:127],
|
|
1000: _TokenTypeName[127:134],
|
|
1001: _TokenTypeName[134:149],
|
|
1002: _TokenTypeName[149:167],
|
|
1003: _TokenTypeName[167:183],
|
|
1004: _TokenTypeName[183:196],
|
|
1005: _TokenTypeName[196:211],
|
|
1006: _TokenTypeName[211:222],
|
|
2000: _TokenTypeName[222:226],
|
|
2001: _TokenTypeName[226:239],
|
|
2002: _TokenTypeName[239:250],
|
|
2003: _TokenTypeName[250:267],
|
|
2004: _TokenTypeName[267:276],
|
|
2005: _TokenTypeName[276:288],
|
|
2006: _TokenTypeName[288:301],
|
|
2007: _TokenTypeName[301:311],
|
|
2008: _TokenTypeName[311:324],
|
|
2009: _TokenTypeName[324:336],
|
|
2010: _TokenTypeName[336:353],
|
|
2011: _TokenTypeName[353:364],
|
|
2012: _TokenTypeName[364:373],
|
|
2013: _TokenTypeName[373:386],
|
|
2014: _TokenTypeName[386:398],
|
|
2015: _TokenTypeName[398:407],
|
|
2016: _TokenTypeName[407:417],
|
|
2017: _TokenTypeName[417:429],
|
|
2018: _TokenTypeName[429:436],
|
|
2019: _TokenTypeName[436:448],
|
|
2020: _TokenTypeName[448:469],
|
|
2021: _TokenTypeName[469:486],
|
|
2022: _TokenTypeName[486:504],
|
|
2023: _TokenTypeName[504:524],
|
|
2024: _TokenTypeName[524:541],
|
|
3000: _TokenTypeName[541:548],
|
|
3001: _TokenTypeName[548:559],
|
|
3002: _TokenTypeName[559:571],
|
|
3100: _TokenTypeName[571:584],
|
|
3101: _TokenTypeName[584:602],
|
|
3102: _TokenTypeName[602:619],
|
|
3103: _TokenTypeName[619:640],
|
|
3104: _TokenTypeName[640:660],
|
|
3105: _TokenTypeName[660:677],
|
|
3106: _TokenTypeName[677:699],
|
|
3107: _TokenTypeName[699:715],
|
|
3108: _TokenTypeName[715:734],
|
|
3109: _TokenTypeName[734:753],
|
|
3110: _TokenTypeName[753:773],
|
|
3111: _TokenTypeName[773:794],
|
|
3112: _TokenTypeName[794:811],
|
|
3113: _TokenTypeName[811:829],
|
|
3114: _TokenTypeName[829:847],
|
|
3115: _TokenTypeName[847:866],
|
|
3116: _TokenTypeName[866:885],
|
|
3200: _TokenTypeName[885:898],
|
|
3201: _TokenTypeName[898:914],
|
|
3202: _TokenTypeName[914:932],
|
|
3203: _TokenTypeName[932:948],
|
|
3204: _TokenTypeName[948:968],
|
|
3205: _TokenTypeName[968:992],
|
|
3206: _TokenTypeName[992:1008],
|
|
3207: _TokenTypeName[1008:1025],
|
|
4000: _TokenTypeName[1025:1033],
|
|
4001: _TokenTypeName[1033:1045],
|
|
5000: _TokenTypeName[1045:1056],
|
|
6000: _TokenTypeName[1056:1063],
|
|
6001: _TokenTypeName[1063:1078],
|
|
6002: _TokenTypeName[1078:1094],
|
|
6003: _TokenTypeName[1094:1107],
|
|
6004: _TokenTypeName[1107:1121],
|
|
6100: _TokenTypeName[1121:1135],
|
|
6101: _TokenTypeName[1135:1153],
|
|
7000: _TokenTypeName[1153:1160],
|
|
7001: _TokenTypeName[1160:1174],
|
|
7002: _TokenTypeName[1174:1185],
|
|
7003: _TokenTypeName[1185:1197],
|
|
7004: _TokenTypeName[1197:1211],
|
|
7005: _TokenTypeName[1211:1226],
|
|
7006: _TokenTypeName[1226:1239],
|
|
7007: _TokenTypeName[1239:1252],
|
|
7008: _TokenTypeName[1252:1265],
|
|
7009: _TokenTypeName[1265:1282],
|
|
7010: _TokenTypeName[1282:1298],
|
|
7011: _TokenTypeName[1298:1314],
|
|
8000: _TokenTypeName[1314:1318],
|
|
8001: _TokenTypeName[1318:1332],
|
|
8002: _TokenTypeName[1332:1342],
|
|
8003: _TokenTypeName[1342:1357],
|
|
}
|
|
|
|
func (i TokenType) String() string {
|
|
if str, ok := _TokenTypeMap[i]; ok {
|
|
return str
|
|
}
|
|
return fmt.Sprintf("TokenType(%d)", i)
|
|
}
|
|
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
func _TokenTypeNoOp() {
|
|
var x [1]struct{}
|
|
_ = x[Ignore-(-14)]
|
|
_ = x[None-(-13)]
|
|
_ = x[Other-(-12)]
|
|
_ = x[Error-(-11)]
|
|
_ = x[CodeLine-(-10)]
|
|
_ = x[LineLink-(-9)]
|
|
_ = x[LineTableTD-(-8)]
|
|
_ = x[LineTable-(-7)]
|
|
_ = x[LineHighlight-(-6)]
|
|
_ = x[LineNumbersTable-(-5)]
|
|
_ = x[LineNumbers-(-4)]
|
|
_ = x[Line-(-3)]
|
|
_ = x[PreWrapper-(-2)]
|
|
_ = x[Background-(-1)]
|
|
_ = x[EOFType-(0)]
|
|
_ = x[Keyword-(1000)]
|
|
_ = x[KeywordConstant-(1001)]
|
|
_ = x[KeywordDeclaration-(1002)]
|
|
_ = x[KeywordNamespace-(1003)]
|
|
_ = x[KeywordPseudo-(1004)]
|
|
_ = x[KeywordReserved-(1005)]
|
|
_ = x[KeywordType-(1006)]
|
|
_ = x[Name-(2000)]
|
|
_ = x[NameAttribute-(2001)]
|
|
_ = x[NameBuiltin-(2002)]
|
|
_ = x[NameBuiltinPseudo-(2003)]
|
|
_ = x[NameClass-(2004)]
|
|
_ = x[NameConstant-(2005)]
|
|
_ = x[NameDecorator-(2006)]
|
|
_ = x[NameEntity-(2007)]
|
|
_ = x[NameException-(2008)]
|
|
_ = x[NameFunction-(2009)]
|
|
_ = x[NameFunctionMagic-(2010)]
|
|
_ = x[NameKeyword-(2011)]
|
|
_ = x[NameLabel-(2012)]
|
|
_ = x[NameNamespace-(2013)]
|
|
_ = x[NameOperator-(2014)]
|
|
_ = x[NameOther-(2015)]
|
|
_ = x[NamePseudo-(2016)]
|
|
_ = x[NameProperty-(2017)]
|
|
_ = x[NameTag-(2018)]
|
|
_ = x[NameVariable-(2019)]
|
|
_ = x[NameVariableAnonymous-(2020)]
|
|
_ = x[NameVariableClass-(2021)]
|
|
_ = x[NameVariableGlobal-(2022)]
|
|
_ = x[NameVariableInstance-(2023)]
|
|
_ = x[NameVariableMagic-(2024)]
|
|
_ = x[Literal-(3000)]
|
|
_ = x[LiteralDate-(3001)]
|
|
_ = x[LiteralOther-(3002)]
|
|
_ = x[LiteralString-(3100)]
|
|
_ = x[LiteralStringAffix-(3101)]
|
|
_ = x[LiteralStringAtom-(3102)]
|
|
_ = x[LiteralStringBacktick-(3103)]
|
|
_ = x[LiteralStringBoolean-(3104)]
|
|
_ = x[LiteralStringChar-(3105)]
|
|
_ = x[LiteralStringDelimiter-(3106)]
|
|
_ = x[LiteralStringDoc-(3107)]
|
|
_ = x[LiteralStringDouble-(3108)]
|
|
_ = x[LiteralStringEscape-(3109)]
|
|
_ = x[LiteralStringHeredoc-(3110)]
|
|
_ = x[LiteralStringInterpol-(3111)]
|
|
_ = x[LiteralStringName-(3112)]
|
|
_ = x[LiteralStringOther-(3113)]
|
|
_ = x[LiteralStringRegex-(3114)]
|
|
_ = x[LiteralStringSingle-(3115)]
|
|
_ = x[LiteralStringSymbol-(3116)]
|
|
_ = x[LiteralNumber-(3200)]
|
|
_ = x[LiteralNumberBin-(3201)]
|
|
_ = x[LiteralNumberFloat-(3202)]
|
|
_ = x[LiteralNumberHex-(3203)]
|
|
_ = x[LiteralNumberInteger-(3204)]
|
|
_ = x[LiteralNumberIntegerLong-(3205)]
|
|
_ = x[LiteralNumberOct-(3206)]
|
|
_ = x[LiteralNumberByte-(3207)]
|
|
_ = x[Operator-(4000)]
|
|
_ = x[OperatorWord-(4001)]
|
|
_ = x[Punctuation-(5000)]
|
|
_ = x[Comment-(6000)]
|
|
_ = x[CommentHashbang-(6001)]
|
|
_ = x[CommentMultiline-(6002)]
|
|
_ = x[CommentSingle-(6003)]
|
|
_ = x[CommentSpecial-(6004)]
|
|
_ = x[CommentPreproc-(6100)]
|
|
_ = x[CommentPreprocFile-(6101)]
|
|
_ = x[Generic-(7000)]
|
|
_ = x[GenericDeleted-(7001)]
|
|
_ = x[GenericEmph-(7002)]
|
|
_ = x[GenericError-(7003)]
|
|
_ = x[GenericHeading-(7004)]
|
|
_ = x[GenericInserted-(7005)]
|
|
_ = x[GenericOutput-(7006)]
|
|
_ = x[GenericPrompt-(7007)]
|
|
_ = x[GenericStrong-(7008)]
|
|
_ = x[GenericSubheading-(7009)]
|
|
_ = x[GenericTraceback-(7010)]
|
|
_ = x[GenericUnderline-(7011)]
|
|
_ = x[Text-(8000)]
|
|
_ = x[TextWhitespace-(8001)]
|
|
_ = x[TextSymbol-(8002)]
|
|
_ = x[TextPunctuation-(8003)]
|
|
}
|
|
|
|
var _TokenTypeValues = []TokenType{Ignore, None, Other, Error, CodeLine, LineLink, LineTableTD, LineTable, LineHighlight, LineNumbersTable, LineNumbers, Line, PreWrapper, Background, EOFType, Keyword, KeywordConstant, KeywordDeclaration, KeywordNamespace, KeywordPseudo, KeywordReserved, KeywordType, Name, NameAttribute, NameBuiltin, NameBuiltinPseudo, NameClass, NameConstant, NameDecorator, NameEntity, NameException, NameFunction, NameFunctionMagic, NameKeyword, NameLabel, NameNamespace, NameOperator, NameOther, NamePseudo, NameProperty, NameTag, NameVariable, NameVariableAnonymous, NameVariableClass, NameVariableGlobal, NameVariableInstance, NameVariableMagic, Literal, LiteralDate, LiteralOther, LiteralString, LiteralStringAffix, LiteralStringAtom, LiteralStringBacktick, LiteralStringBoolean, LiteralStringChar, LiteralStringDelimiter, LiteralStringDoc, LiteralStringDouble, LiteralStringEscape, LiteralStringHeredoc, LiteralStringInterpol, LiteralStringName, LiteralStringOther, LiteralStringRegex, LiteralStringSingle, LiteralStringSymbol, LiteralNumber, LiteralNumberBin, LiteralNumberFloat, LiteralNumberHex, LiteralNumberInteger, LiteralNumberIntegerLong, LiteralNumberOct, LiteralNumberByte, Operator, OperatorWord, Punctuation, Comment, CommentHashbang, CommentMultiline, CommentSingle, CommentSpecial, CommentPreproc, CommentPreprocFile, Generic, GenericDeleted, GenericEmph, GenericError, GenericHeading, GenericInserted, GenericOutput, GenericPrompt, GenericStrong, GenericSubheading, GenericTraceback, GenericUnderline, Text, TextWhitespace, TextSymbol, TextPunctuation}
|
|
|
|
var _TokenTypeNameToValueMap = map[string]TokenType{
|
|
_TokenTypeName[0:6]: Ignore,
|
|
_TokenTypeLowerName[0:6]: Ignore,
|
|
_TokenTypeName[6:10]: None,
|
|
_TokenTypeLowerName[6:10]: None,
|
|
_TokenTypeName[10:15]: Other,
|
|
_TokenTypeLowerName[10:15]: Other,
|
|
_TokenTypeName[15:20]: Error,
|
|
_TokenTypeLowerName[15:20]: Error,
|
|
_TokenTypeName[20:28]: CodeLine,
|
|
_TokenTypeLowerName[20:28]: CodeLine,
|
|
_TokenTypeName[28:36]: LineLink,
|
|
_TokenTypeLowerName[28:36]: LineLink,
|
|
_TokenTypeName[36:47]: LineTableTD,
|
|
_TokenTypeLowerName[36:47]: LineTableTD,
|
|
_TokenTypeName[47:56]: LineTable,
|
|
_TokenTypeLowerName[47:56]: LineTable,
|
|
_TokenTypeName[56:69]: LineHighlight,
|
|
_TokenTypeLowerName[56:69]: LineHighlight,
|
|
_TokenTypeName[69:85]: LineNumbersTable,
|
|
_TokenTypeLowerName[69:85]: LineNumbersTable,
|
|
_TokenTypeName[85:96]: LineNumbers,
|
|
_TokenTypeLowerName[85:96]: LineNumbers,
|
|
_TokenTypeName[96:100]: Line,
|
|
_TokenTypeLowerName[96:100]: Line,
|
|
_TokenTypeName[100:110]: PreWrapper,
|
|
_TokenTypeLowerName[100:110]: PreWrapper,
|
|
_TokenTypeName[110:120]: Background,
|
|
_TokenTypeLowerName[110:120]: Background,
|
|
_TokenTypeName[120:127]: EOFType,
|
|
_TokenTypeLowerName[120:127]: EOFType,
|
|
_TokenTypeName[127:134]: Keyword,
|
|
_TokenTypeLowerName[127:134]: Keyword,
|
|
_TokenTypeName[134:149]: KeywordConstant,
|
|
_TokenTypeLowerName[134:149]: KeywordConstant,
|
|
_TokenTypeName[149:167]: KeywordDeclaration,
|
|
_TokenTypeLowerName[149:167]: KeywordDeclaration,
|
|
_TokenTypeName[167:183]: KeywordNamespace,
|
|
_TokenTypeLowerName[167:183]: KeywordNamespace,
|
|
_TokenTypeName[183:196]: KeywordPseudo,
|
|
_TokenTypeLowerName[183:196]: KeywordPseudo,
|
|
_TokenTypeName[196:211]: KeywordReserved,
|
|
_TokenTypeLowerName[196:211]: KeywordReserved,
|
|
_TokenTypeName[211:222]: KeywordType,
|
|
_TokenTypeLowerName[211:222]: KeywordType,
|
|
_TokenTypeName[222:226]: Name,
|
|
_TokenTypeLowerName[222:226]: Name,
|
|
_TokenTypeName[226:239]: NameAttribute,
|
|
_TokenTypeLowerName[226:239]: NameAttribute,
|
|
_TokenTypeName[239:250]: NameBuiltin,
|
|
_TokenTypeLowerName[239:250]: NameBuiltin,
|
|
_TokenTypeName[250:267]: NameBuiltinPseudo,
|
|
_TokenTypeLowerName[250:267]: NameBuiltinPseudo,
|
|
_TokenTypeName[267:276]: NameClass,
|
|
_TokenTypeLowerName[267:276]: NameClass,
|
|
_TokenTypeName[276:288]: NameConstant,
|
|
_TokenTypeLowerName[276:288]: NameConstant,
|
|
_TokenTypeName[288:301]: NameDecorator,
|
|
_TokenTypeLowerName[288:301]: NameDecorator,
|
|
_TokenTypeName[301:311]: NameEntity,
|
|
_TokenTypeLowerName[301:311]: NameEntity,
|
|
_TokenTypeName[311:324]: NameException,
|
|
_TokenTypeLowerName[311:324]: NameException,
|
|
_TokenTypeName[324:336]: NameFunction,
|
|
_TokenTypeLowerName[324:336]: NameFunction,
|
|
_TokenTypeName[336:353]: NameFunctionMagic,
|
|
_TokenTypeLowerName[336:353]: NameFunctionMagic,
|
|
_TokenTypeName[353:364]: NameKeyword,
|
|
_TokenTypeLowerName[353:364]: NameKeyword,
|
|
_TokenTypeName[364:373]: NameLabel,
|
|
_TokenTypeLowerName[364:373]: NameLabel,
|
|
_TokenTypeName[373:386]: NameNamespace,
|
|
_TokenTypeLowerName[373:386]: NameNamespace,
|
|
_TokenTypeName[386:398]: NameOperator,
|
|
_TokenTypeLowerName[386:398]: NameOperator,
|
|
_TokenTypeName[398:407]: NameOther,
|
|
_TokenTypeLowerName[398:407]: NameOther,
|
|
_TokenTypeName[407:417]: NamePseudo,
|
|
_TokenTypeLowerName[407:417]: NamePseudo,
|
|
_TokenTypeName[417:429]: NameProperty,
|
|
_TokenTypeLowerName[417:429]: NameProperty,
|
|
_TokenTypeName[429:436]: NameTag,
|
|
_TokenTypeLowerName[429:436]: NameTag,
|
|
_TokenTypeName[436:448]: NameVariable,
|
|
_TokenTypeLowerName[436:448]: NameVariable,
|
|
_TokenTypeName[448:469]: NameVariableAnonymous,
|
|
_TokenTypeLowerName[448:469]: NameVariableAnonymous,
|
|
_TokenTypeName[469:486]: NameVariableClass,
|
|
_TokenTypeLowerName[469:486]: NameVariableClass,
|
|
_TokenTypeName[486:504]: NameVariableGlobal,
|
|
_TokenTypeLowerName[486:504]: NameVariableGlobal,
|
|
_TokenTypeName[504:524]: NameVariableInstance,
|
|
_TokenTypeLowerName[504:524]: NameVariableInstance,
|
|
_TokenTypeName[524:541]: NameVariableMagic,
|
|
_TokenTypeLowerName[524:541]: NameVariableMagic,
|
|
_TokenTypeName[541:548]: Literal,
|
|
_TokenTypeLowerName[541:548]: Literal,
|
|
_TokenTypeName[548:559]: LiteralDate,
|
|
_TokenTypeLowerName[548:559]: LiteralDate,
|
|
_TokenTypeName[559:571]: LiteralOther,
|
|
_TokenTypeLowerName[559:571]: LiteralOther,
|
|
_TokenTypeName[571:584]: LiteralString,
|
|
_TokenTypeLowerName[571:584]: LiteralString,
|
|
_TokenTypeName[584:602]: LiteralStringAffix,
|
|
_TokenTypeLowerName[584:602]: LiteralStringAffix,
|
|
_TokenTypeName[602:619]: LiteralStringAtom,
|
|
_TokenTypeLowerName[602:619]: LiteralStringAtom,
|
|
_TokenTypeName[619:640]: LiteralStringBacktick,
|
|
_TokenTypeLowerName[619:640]: LiteralStringBacktick,
|
|
_TokenTypeName[640:660]: LiteralStringBoolean,
|
|
_TokenTypeLowerName[640:660]: LiteralStringBoolean,
|
|
_TokenTypeName[660:677]: LiteralStringChar,
|
|
_TokenTypeLowerName[660:677]: LiteralStringChar,
|
|
_TokenTypeName[677:699]: LiteralStringDelimiter,
|
|
_TokenTypeLowerName[677:699]: LiteralStringDelimiter,
|
|
_TokenTypeName[699:715]: LiteralStringDoc,
|
|
_TokenTypeLowerName[699:715]: LiteralStringDoc,
|
|
_TokenTypeName[715:734]: LiteralStringDouble,
|
|
_TokenTypeLowerName[715:734]: LiteralStringDouble,
|
|
_TokenTypeName[734:753]: LiteralStringEscape,
|
|
_TokenTypeLowerName[734:753]: LiteralStringEscape,
|
|
_TokenTypeName[753:773]: LiteralStringHeredoc,
|
|
_TokenTypeLowerName[753:773]: LiteralStringHeredoc,
|
|
_TokenTypeName[773:794]: LiteralStringInterpol,
|
|
_TokenTypeLowerName[773:794]: LiteralStringInterpol,
|
|
_TokenTypeName[794:811]: LiteralStringName,
|
|
_TokenTypeLowerName[794:811]: LiteralStringName,
|
|
_TokenTypeName[811:829]: LiteralStringOther,
|
|
_TokenTypeLowerName[811:829]: LiteralStringOther,
|
|
_TokenTypeName[829:847]: LiteralStringRegex,
|
|
_TokenTypeLowerName[829:847]: LiteralStringRegex,
|
|
_TokenTypeName[847:866]: LiteralStringSingle,
|
|
_TokenTypeLowerName[847:866]: LiteralStringSingle,
|
|
_TokenTypeName[866:885]: LiteralStringSymbol,
|
|
_TokenTypeLowerName[866:885]: LiteralStringSymbol,
|
|
_TokenTypeName[885:898]: LiteralNumber,
|
|
_TokenTypeLowerName[885:898]: LiteralNumber,
|
|
_TokenTypeName[898:914]: LiteralNumberBin,
|
|
_TokenTypeLowerName[898:914]: LiteralNumberBin,
|
|
_TokenTypeName[914:932]: LiteralNumberFloat,
|
|
_TokenTypeLowerName[914:932]: LiteralNumberFloat,
|
|
_TokenTypeName[932:948]: LiteralNumberHex,
|
|
_TokenTypeLowerName[932:948]: LiteralNumberHex,
|
|
_TokenTypeName[948:968]: LiteralNumberInteger,
|
|
_TokenTypeLowerName[948:968]: LiteralNumberInteger,
|
|
_TokenTypeName[968:992]: LiteralNumberIntegerLong,
|
|
_TokenTypeLowerName[968:992]: LiteralNumberIntegerLong,
|
|
_TokenTypeName[992:1008]: LiteralNumberOct,
|
|
_TokenTypeLowerName[992:1008]: LiteralNumberOct,
|
|
_TokenTypeName[1008:1025]: LiteralNumberByte,
|
|
_TokenTypeLowerName[1008:1025]: LiteralNumberByte,
|
|
_TokenTypeName[1025:1033]: Operator,
|
|
_TokenTypeLowerName[1025:1033]: Operator,
|
|
_TokenTypeName[1033:1045]: OperatorWord,
|
|
_TokenTypeLowerName[1033:1045]: OperatorWord,
|
|
_TokenTypeName[1045:1056]: Punctuation,
|
|
_TokenTypeLowerName[1045:1056]: Punctuation,
|
|
_TokenTypeName[1056:1063]: Comment,
|
|
_TokenTypeLowerName[1056:1063]: Comment,
|
|
_TokenTypeName[1063:1078]: CommentHashbang,
|
|
_TokenTypeLowerName[1063:1078]: CommentHashbang,
|
|
_TokenTypeName[1078:1094]: CommentMultiline,
|
|
_TokenTypeLowerName[1078:1094]: CommentMultiline,
|
|
_TokenTypeName[1094:1107]: CommentSingle,
|
|
_TokenTypeLowerName[1094:1107]: CommentSingle,
|
|
_TokenTypeName[1107:1121]: CommentSpecial,
|
|
_TokenTypeLowerName[1107:1121]: CommentSpecial,
|
|
_TokenTypeName[1121:1135]: CommentPreproc,
|
|
_TokenTypeLowerName[1121:1135]: CommentPreproc,
|
|
_TokenTypeName[1135:1153]: CommentPreprocFile,
|
|
_TokenTypeLowerName[1135:1153]: CommentPreprocFile,
|
|
_TokenTypeName[1153:1160]: Generic,
|
|
_TokenTypeLowerName[1153:1160]: Generic,
|
|
_TokenTypeName[1160:1174]: GenericDeleted,
|
|
_TokenTypeLowerName[1160:1174]: GenericDeleted,
|
|
_TokenTypeName[1174:1185]: GenericEmph,
|
|
_TokenTypeLowerName[1174:1185]: GenericEmph,
|
|
_TokenTypeName[1185:1197]: GenericError,
|
|
_TokenTypeLowerName[1185:1197]: GenericError,
|
|
_TokenTypeName[1197:1211]: GenericHeading,
|
|
_TokenTypeLowerName[1197:1211]: GenericHeading,
|
|
_TokenTypeName[1211:1226]: GenericInserted,
|
|
_TokenTypeLowerName[1211:1226]: GenericInserted,
|
|
_TokenTypeName[1226:1239]: GenericOutput,
|
|
_TokenTypeLowerName[1226:1239]: GenericOutput,
|
|
_TokenTypeName[1239:1252]: GenericPrompt,
|
|
_TokenTypeLowerName[1239:1252]: GenericPrompt,
|
|
_TokenTypeName[1252:1265]: GenericStrong,
|
|
_TokenTypeLowerName[1252:1265]: GenericStrong,
|
|
_TokenTypeName[1265:1282]: GenericSubheading,
|
|
_TokenTypeLowerName[1265:1282]: GenericSubheading,
|
|
_TokenTypeName[1282:1298]: GenericTraceback,
|
|
_TokenTypeLowerName[1282:1298]: GenericTraceback,
|
|
_TokenTypeName[1298:1314]: GenericUnderline,
|
|
_TokenTypeLowerName[1298:1314]: GenericUnderline,
|
|
_TokenTypeName[1314:1318]: Text,
|
|
_TokenTypeLowerName[1314:1318]: Text,
|
|
_TokenTypeName[1318:1332]: TextWhitespace,
|
|
_TokenTypeLowerName[1318:1332]: TextWhitespace,
|
|
_TokenTypeName[1332:1342]: TextSymbol,
|
|
_TokenTypeLowerName[1332:1342]: TextSymbol,
|
|
_TokenTypeName[1342:1357]: TextPunctuation,
|
|
_TokenTypeLowerName[1342:1357]: TextPunctuation,
|
|
}
|
|
|
|
var _TokenTypeNames = []string{
|
|
_TokenTypeName[0:6],
|
|
_TokenTypeName[6:10],
|
|
_TokenTypeName[10:15],
|
|
_TokenTypeName[15:20],
|
|
_TokenTypeName[20:28],
|
|
_TokenTypeName[28:36],
|
|
_TokenTypeName[36:47],
|
|
_TokenTypeName[47:56],
|
|
_TokenTypeName[56:69],
|
|
_TokenTypeName[69:85],
|
|
_TokenTypeName[85:96],
|
|
_TokenTypeName[96:100],
|
|
_TokenTypeName[100:110],
|
|
_TokenTypeName[110:120],
|
|
_TokenTypeName[120:127],
|
|
_TokenTypeName[127:134],
|
|
_TokenTypeName[134:149],
|
|
_TokenTypeName[149:167],
|
|
_TokenTypeName[167:183],
|
|
_TokenTypeName[183:196],
|
|
_TokenTypeName[196:211],
|
|
_TokenTypeName[211:222],
|
|
_TokenTypeName[222:226],
|
|
_TokenTypeName[226:239],
|
|
_TokenTypeName[239:250],
|
|
_TokenTypeName[250:267],
|
|
_TokenTypeName[267:276],
|
|
_TokenTypeName[276:288],
|
|
_TokenTypeName[288:301],
|
|
_TokenTypeName[301:311],
|
|
_TokenTypeName[311:324],
|
|
_TokenTypeName[324:336],
|
|
_TokenTypeName[336:353],
|
|
_TokenTypeName[353:364],
|
|
_TokenTypeName[364:373],
|
|
_TokenTypeName[373:386],
|
|
_TokenTypeName[386:398],
|
|
_TokenTypeName[398:407],
|
|
_TokenTypeName[407:417],
|
|
_TokenTypeName[417:429],
|
|
_TokenTypeName[429:436],
|
|
_TokenTypeName[436:448],
|
|
_TokenTypeName[448:469],
|
|
_TokenTypeName[469:486],
|
|
_TokenTypeName[486:504],
|
|
_TokenTypeName[504:524],
|
|
_TokenTypeName[524:541],
|
|
_TokenTypeName[541:548],
|
|
_TokenTypeName[548:559],
|
|
_TokenTypeName[559:571],
|
|
_TokenTypeName[571:584],
|
|
_TokenTypeName[584:602],
|
|
_TokenTypeName[602:619],
|
|
_TokenTypeName[619:640],
|
|
_TokenTypeName[640:660],
|
|
_TokenTypeName[660:677],
|
|
_TokenTypeName[677:699],
|
|
_TokenTypeName[699:715],
|
|
_TokenTypeName[715:734],
|
|
_TokenTypeName[734:753],
|
|
_TokenTypeName[753:773],
|
|
_TokenTypeName[773:794],
|
|
_TokenTypeName[794:811],
|
|
_TokenTypeName[811:829],
|
|
_TokenTypeName[829:847],
|
|
_TokenTypeName[847:866],
|
|
_TokenTypeName[866:885],
|
|
_TokenTypeName[885:898],
|
|
_TokenTypeName[898:914],
|
|
_TokenTypeName[914:932],
|
|
_TokenTypeName[932:948],
|
|
_TokenTypeName[948:968],
|
|
_TokenTypeName[968:992],
|
|
_TokenTypeName[992:1008],
|
|
_TokenTypeName[1008:1025],
|
|
_TokenTypeName[1025:1033],
|
|
_TokenTypeName[1033:1045],
|
|
_TokenTypeName[1045:1056],
|
|
_TokenTypeName[1056:1063],
|
|
_TokenTypeName[1063:1078],
|
|
_TokenTypeName[1078:1094],
|
|
_TokenTypeName[1094:1107],
|
|
_TokenTypeName[1107:1121],
|
|
_TokenTypeName[1121:1135],
|
|
_TokenTypeName[1135:1153],
|
|
_TokenTypeName[1153:1160],
|
|
_TokenTypeName[1160:1174],
|
|
_TokenTypeName[1174:1185],
|
|
_TokenTypeName[1185:1197],
|
|
_TokenTypeName[1197:1211],
|
|
_TokenTypeName[1211:1226],
|
|
_TokenTypeName[1226:1239],
|
|
_TokenTypeName[1239:1252],
|
|
_TokenTypeName[1252:1265],
|
|
_TokenTypeName[1265:1282],
|
|
_TokenTypeName[1282:1298],
|
|
_TokenTypeName[1298:1314],
|
|
_TokenTypeName[1314:1318],
|
|
_TokenTypeName[1318:1332],
|
|
_TokenTypeName[1332:1342],
|
|
_TokenTypeName[1342:1357],
|
|
}
|
|
|
|
// TokenTypeString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func TokenTypeString(s string) (TokenType, error) {
|
|
if val, ok := _TokenTypeNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
|
|
if val, ok := _TokenTypeNameToValueMap[strings.ToLower(s)]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to TokenType values", s)
|
|
}
|
|
|
|
// TokenTypeValues returns all values of the enum
|
|
func TokenTypeValues() []TokenType {
|
|
return _TokenTypeValues
|
|
}
|
|
|
|
// TokenTypeStrings returns a slice of all String values of the enum
|
|
func TokenTypeStrings() []string {
|
|
strs := make([]string, len(_TokenTypeNames))
|
|
copy(strs, _TokenTypeNames)
|
|
return strs
|
|
}
|
|
|
|
// IsATokenType returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i TokenType) IsATokenType() bool {
|
|
_, ok := _TokenTypeMap[i]
|
|
return ok
|
|
}
|
|
|
|
// MarshalText implements the encoding.TextMarshaler interface for TokenType
|
|
func (i TokenType) MarshalText() ([]byte, error) {
|
|
return []byte(i.String()), nil
|
|
}
|
|
|
|
// UnmarshalText implements the encoding.TextUnmarshaler interface for TokenType
|
|
func (i *TokenType) UnmarshalText(text []byte) error {
|
|
var err error
|
|
*i, err = TokenTypeString(string(text))
|
|
return err
|
|
}
|