2 * Copyright (c) 2016, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional
11 * THIS FILE IS @generated; DO NOT EDIT IT
12 * To regenerate this file, run
14 * buck run //hphp/hack/src:generate_full_fidelity
23 (* Given text tokens *)
151 | LessThanEqualGreaterThan
153 | GreaterThanGreaterThan
161 | ExclamationEqualEqual
171 | QuestionQuestionEqual
182 | LessThanLessThanEqual
183 | GreaterThanGreaterThanEqual
191 | EqualEqualGreaterThan
192 | QuestionMinusGreaterThan
207 (* Variable text tokens *)
216 | SingleQuotedStringLiteral
217 | DoubleQuotedStringLiteral
218 | DoubleQuotedStringLiteralHead
220 | DoubleQuotedStringLiteralTail
221 | HeredocStringLiteral
222 | HeredocStringLiteralHead
223 | HeredocStringLiteralTail
224 | NowdocStringLiteral
233 [@@deriving show
, eq
, sexp_of
]
235 let from_string keyword ~only_reserved
=
237 | "true" when not only_reserved
-> Some BooleanLiteral
238 | "false" when not only_reserved
-> Some BooleanLiteral
239 | "abstract" -> Some Abstract
240 | "arraykey" when not only_reserved
-> Some Arraykey
242 | "async" -> Some Async
243 | "attribute" when not only_reserved
-> Some Attribute
244 | "await" -> Some Await
245 | "\\" -> Some Backslash
246 | "binary" when not only_reserved
-> Some Binary
247 | "bool" when not only_reserved
-> Some Bool
248 | "boolean" when not only_reserved
-> Some Boolean
249 | "break" -> Some Break
250 | "case" -> Some Case
251 | "catch" -> Some Catch
252 | "category" when not only_reserved
-> Some Category
253 | "children" when not only_reserved
-> Some Children
254 | "class" -> Some Class
255 | "classname" when not only_reserved
-> Some Classname
256 | "clone" -> Some Clone
257 | "concurrent" -> Some Concurrent
258 | "const" -> Some Const
259 | "__construct" -> Some Construct
260 | "continue" -> Some Continue
262 | "darray" when not only_reserved
-> Some Darray
263 | "default" -> Some Default
264 | "dict" when not only_reserved
-> Some Dict
266 | "double" when not only_reserved
-> Some Double
267 | "echo" -> Some Echo
268 | "else" -> Some Else
269 | "empty" -> Some Empty
270 | "endif" -> Some Endif
271 | "enum" when not only_reserved
-> Some Enum
272 | "eval" -> Some Eval
273 | "exports" when not only_reserved
-> Some Exports
274 | "extends" -> Some Extends
275 | "fallthrough" when not only_reserved
-> Some Fallthrough
276 | "float" when not only_reserved
-> Some Float
277 | "file" when not only_reserved
-> Some File
278 | "final" -> Some Final
279 | "finally" -> Some Finally
281 | "foreach" -> Some Foreach
282 | "function" -> Some Function
283 | "global" -> Some Global
285 | "implements" -> Some Implements
286 | "imports" when not only_reserved
-> Some Imports
287 | "include" -> Some Include
288 | "include_once" -> Some Include_once
289 | "inout" -> Some Inout
290 | "instanceof" -> Some Instanceof
291 | "insteadof" -> Some Insteadof
292 | "int" when not only_reserved
-> Some Int
293 | "integer" when not only_reserved
-> Some Integer
294 | "interface" -> Some Interface
295 | "is" when not only_reserved
-> Some Is
296 | "isset" -> Some Isset
297 | "keyset" when not only_reserved
-> Some Keyset
298 | "lateinit" -> Some Lateinit
299 | "list" -> Some List
300 | "match" when not only_reserved
-> Some Match
301 | "mixed" when not only_reserved
-> Some Mixed
302 | "module" -> Some Module
303 | "nameof" -> Some Nameof
304 | "namespace" -> Some Namespace
306 | "newctx" when not only_reserved
-> Some Newctx
307 | "newtype" when not only_reserved
-> Some Newtype
308 | "noreturn" when not only_reserved
-> Some Noreturn
309 | "num" when not only_reserved
-> Some Num
310 | "parent" when not only_reserved
-> Some Parent
311 | "print" -> Some Print
312 | "private" -> Some Private
313 | "protected" -> Some Protected
314 | "public" -> Some Public
315 | "real" when not only_reserved
-> Some Real
316 | "reify" when not only_reserved
-> Some Reify
317 | "require" -> Some Require
318 | "require_once" -> Some Require_once
319 | "required" -> Some Required
320 | "resource" when not only_reserved
-> Some Resource
321 | "return" -> Some Return
322 | "self" when not only_reserved
-> Some Self
323 | "shape" -> Some Shape
324 | "static" -> Some Static
325 | "string" when not only_reserved
-> Some String
326 | "super" when not only_reserved
-> Some Super
327 | "switch" -> Some Switch
328 | "this" when not only_reserved
-> Some This
329 | "throw" -> Some Throw
330 | "trait" -> Some Trait
332 | "tuple" -> Some Tuple
333 | "type" when not only_reserved
-> Some Type
334 | "unset" -> Some Unset
335 | "upcast" when not only_reserved
-> Some Upcast
337 | "using" -> Some Using
339 | "varray" when not only_reserved
-> Some Varray
340 | "vec" when not only_reserved
-> Some Vec
341 | "void" when not only_reserved
-> Some Void
342 | "with" when not only_reserved
-> Some With
343 | "where" when not only_reserved
-> Some Where
344 | "while" -> Some While
345 | "yield" -> Some Yield
346 | "null" when not only_reserved
-> Some NullLiteral
347 | "[" -> Some LeftBracket
348 | "]" -> Some RightBracket
349 | "(" -> Some LeftParen
350 | ")" -> Some RightParen
351 | "{" -> Some LeftBrace
352 | "}" -> Some RightBrace
354 | "->" -> Some MinusGreaterThan
355 | "++" -> Some PlusPlus
356 | "--" -> Some MinusMinus
357 | "**" -> Some StarStar
362 | "!" -> Some Exclamation
365 | "%" -> Some Percent
366 | "<=>" -> Some LessThanEqualGreaterThan
367 | "<<" -> Some LessThanLessThan
368 | ">>" -> Some GreaterThanGreaterThan
369 | "<" -> Some LessThan
370 | ">" -> Some GreaterThan
371 | "<=" -> Some LessThanEqual
372 | ">=" -> Some GreaterThanEqual
373 | "==" -> Some EqualEqual
374 | "===" -> Some EqualEqualEqual
375 | "!=" -> Some ExclamationEqual
376 | "!==" -> Some ExclamationEqualEqual
379 | "&" -> Some Ampersand
380 | "&&" -> Some AmpersandAmpersand
381 | "||" -> Some BarBar
382 | "?" -> Some Question
383 | "?as" -> Some QuestionAs
384 | "?:" -> Some QuestionColon
385 | "??" -> Some QuestionQuestion
386 | "??=" -> Some QuestionQuestionEqual
388 | ";" -> Some Semicolon
390 | "**=" -> Some StarStarEqual
391 | "*=" -> Some StarEqual
392 | "/=" -> Some SlashEqual
393 | "%=" -> Some PercentEqual
394 | "+=" -> Some PlusEqual
395 | "-=" -> Some MinusEqual
396 | ".=" -> Some DotEqual
397 | "<<=" -> Some LessThanLessThanEqual
398 | ">>=" -> Some GreaterThanGreaterThanEqual
399 | "&=" -> Some AmpersandEqual
400 | "^=" -> Some CaratEqual
401 | "|=" -> Some BarEqual
404 | "::" -> Some ColonColon
405 | "=>" -> Some EqualGreaterThan
406 | "==>" -> Some EqualEqualGreaterThan
407 | "?->" -> Some QuestionMinusGreaterThan
408 | "..." -> Some DotDotDot
409 | "$$" -> Some DollarDollar
410 | "|>" -> Some BarGreaterThan
411 | "/>" -> Some SlashGreaterThan
412 | "</" -> Some LessThanSlash
413 | "<?" -> Some LessThanQuestion
414 | "`" -> Some Backtick
415 | "xhp" when not only_reserved
-> Some XHP
417 | "readonly" -> Some Readonly
418 | "internal" when not only_reserved
-> Some Internal
419 | "package" -> Some Package
420 | "let" when not only_reserved
-> Some Let
421 | "optional" when not only_reserved
-> Some Optional
427 | EndOfFile
-> "end_of_file"
428 (* Given text tokens *)
429 | Abstract
-> "abstract"
430 | Arraykey
-> "arraykey"
433 | Attribute
-> "attribute"
438 | Boolean
-> "boolean"
442 | Category
-> "category"
443 | Children
-> "children"
445 | Classname
-> "classname"
447 | Concurrent
-> "concurrent"
449 | Construct
-> "__construct"
450 | Continue
-> "continue"
453 | Default
-> "default"
463 | Exports
-> "exports"
464 | Extends
-> "extends"
465 | Fallthrough
-> "fallthrough"
469 | Finally
-> "finally"
471 | Foreach
-> "foreach"
472 | Function
-> "function"
475 | Implements
-> "implements"
476 | Imports
-> "imports"
477 | Include
-> "include"
478 | Include_once
-> "include_once"
480 | Instanceof
-> "instanceof"
481 | Insteadof
-> "insteadof"
483 | Integer
-> "integer"
484 | Interface
-> "interface"
488 | Lateinit
-> "lateinit"
494 | Namespace
-> "namespace"
497 | Newtype
-> "newtype"
498 | Noreturn
-> "noreturn"
502 | Private
-> "private"
503 | Protected
-> "protected"
507 | Require
-> "require"
508 | Require_once
-> "require_once"
509 | Required
-> "required"
510 | Resource
-> "resource"
536 | NullLiteral
-> "null"
538 | RightBracket
-> "]"
544 | MinusGreaterThan
-> "->"
556 | LessThanEqualGreaterThan
-> "<=>"
557 | LessThanLessThan
-> "<<"
558 | GreaterThanGreaterThan
-> ">>"
561 | LessThanEqual
-> "<="
562 | GreaterThanEqual
-> ">="
564 | EqualEqualEqual
-> "==="
565 | ExclamationEqual
-> "!="
566 | ExclamationEqualEqual
-> "!=="
570 | AmpersandAmpersand
-> "&&"
573 | QuestionAs
-> "?as"
574 | QuestionColon
-> "?:"
575 | QuestionQuestion
-> "??"
576 | QuestionQuestionEqual
-> "??="
580 | StarStarEqual
-> "**="
583 | PercentEqual
-> "%="
587 | LessThanLessThanEqual
-> "<<="
588 | GreaterThanGreaterThanEqual
-> ">>="
589 | AmpersandEqual
-> "&="
595 | EqualGreaterThan
-> "=>"
596 | EqualEqualGreaterThan
-> "==>"
597 | QuestionMinusGreaterThan
-> "?->"
599 | DollarDollar
-> "$$"
600 | BarGreaterThan
-> "|>"
601 | SlashGreaterThan
-> "/>"
602 | LessThanSlash
-> "</"
603 | LessThanQuestion
-> "<?"
607 | Readonly
-> "readonly"
608 | Internal
-> "internal"
609 | Package
-> "package"
611 | Optional
-> "optional"
612 (* Variable text tokens *)
613 | ErrorToken
-> "error_token"
615 | Variable
-> "variable"
616 | DecimalLiteral
-> "decimal_literal"
617 | OctalLiteral
-> "octal_literal"
618 | HexadecimalLiteral
-> "hexadecimal_literal"
619 | BinaryLiteral
-> "binary_literal"
620 | FloatingLiteral
-> "floating_literal"
621 | SingleQuotedStringLiteral
-> "single_quoted_string_literal"
622 | DoubleQuotedStringLiteral
-> "double_quoted_string_literal"
623 | DoubleQuotedStringLiteralHead
-> "double_quoted_string_literal_head"
624 | StringLiteralBody
-> "string_literal_body"
625 | DoubleQuotedStringLiteralTail
-> "double_quoted_string_literal_tail"
626 | HeredocStringLiteral
-> "heredoc_string_literal"
627 | HeredocStringLiteralHead
-> "heredoc_string_literal_head"
628 | HeredocStringLiteralTail
-> "heredoc_string_literal_tail"
629 | NowdocStringLiteral
-> "nowdoc_string_literal"
630 | BooleanLiteral
-> "boolean_literal"
631 | XHPCategoryName
-> "XHP_category_name"
632 | XHPElementName
-> "XHP_element_name"
633 | XHPClassName
-> "XHP_class_name"
634 | XHPStringLiteral
-> "XHP_string_literal"
635 | XHPBody
-> "XHP_body"
636 | XHPComment
-> "XHP_comment"
637 | Hashbang
-> "hashbang"
639 let is_variable_text kind
=
644 | DecimalLiteral
-> true
645 | OctalLiteral
-> true
646 | HexadecimalLiteral
-> true
647 | BinaryLiteral
-> true
648 | FloatingLiteral
-> true
649 | SingleQuotedStringLiteral
-> true
650 | DoubleQuotedStringLiteral
-> true
651 | DoubleQuotedStringLiteralHead
-> true
652 | StringLiteralBody
-> true
653 | DoubleQuotedStringLiteralTail
-> true
654 | HeredocStringLiteral
-> true
655 | HeredocStringLiteralHead
-> true
656 | HeredocStringLiteralTail
-> true
657 | NowdocStringLiteral
-> true
658 | BooleanLiteral
-> true
659 | XHPCategoryName
-> true
660 | XHPElementName
-> true
661 | XHPClassName
-> true
662 | XHPStringLiteral
-> true