@@ -620,13 +620,6 @@ impl<'l> CelCompiler<'l> {
620620 let start_loc = self . tokenizer . location ( ) ;
621621
622622 match self . tokenizer . peek ( ) ? {
623- Some ( Token :: Type ) => {
624- self . tokenizer . next ( ) ?;
625- Ok ( (
626- ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: from_ident( "type" ) ) ] ) ,
627- AstNode :: new ( Primary :: Type , start_loc, self . tokenizer . location ( ) ) ,
628- ) )
629- }
630623 Some ( Token :: Ident ( val) ) => {
631624 self . tokenizer . next ( ) ?;
632625 Ok ( (
@@ -696,7 +689,7 @@ impl<'l> CelCompiler<'l> {
696689 Ok ( (
697690 ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: from_uint( val) ) ] ) ,
698691 AstNode :: new (
699- Primary :: Literal ( Literal :: Unsigned ( val) ) ,
692+ Primary :: Literal ( LiteralsAndKeywords :: UnsignedLit ( val) ) ,
700693 start_loc,
701694 self . tokenizer . location ( ) ,
702695 ) ,
@@ -707,7 +700,7 @@ impl<'l> CelCompiler<'l> {
707700 Ok ( (
708701 ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: from_int( val) ) ] ) ,
709702 AstNode :: new (
710- Primary :: Literal ( Literal :: Integer ( val) ) ,
703+ Primary :: Literal ( LiteralsAndKeywords :: IntegerLit ( val) ) ,
711704 start_loc,
712705 self . tokenizer . location ( ) ,
713706 ) ,
@@ -718,7 +711,7 @@ impl<'l> CelCompiler<'l> {
718711 Ok ( (
719712 ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: from_float( val) ) ] ) ,
720713 AstNode :: new (
721- Primary :: Literal ( Literal :: Floating ( val) ) ,
714+ Primary :: Literal ( LiteralsAndKeywords :: FloatingLit ( val) ) ,
722715 start_loc,
723716 self . tokenizer . location ( ) ,
724717 ) ,
@@ -731,7 +724,7 @@ impl<'l> CelCompiler<'l> {
731724 val. clone( ) ,
732725 ) ) ] ) ,
733726 AstNode :: new (
734- Primary :: Literal ( Literal :: String ( val) ) ,
727+ Primary :: Literal ( LiteralsAndKeywords :: StringLit ( val) ) ,
735728 start_loc,
736729 self . tokenizer . location ( ) ,
737730 ) ,
@@ -744,7 +737,7 @@ impl<'l> CelCompiler<'l> {
744737 val. clone( ) ,
745738 ) ) ] ) ,
746739 AstNode :: new (
747- Primary :: Literal ( Literal :: ByteString ( val) ) ,
740+ Primary :: Literal ( LiteralsAndKeywords :: ByteStringLit ( val) ) ,
748741 start_loc,
749742 self . tokenizer . location ( ) ,
750743 ) ,
@@ -755,7 +748,7 @@ impl<'l> CelCompiler<'l> {
755748 Ok ( (
756749 ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: from_bool( val) ) ] ) ,
757750 AstNode :: new (
758- Primary :: Literal ( Literal :: Boolean ( val) ) ,
751+ Primary :: Literal ( LiteralsAndKeywords :: BooleanLit ( val) ) ,
759752 start_loc,
760753 self . tokenizer . location ( ) ,
761754 ) ,
@@ -766,7 +759,106 @@ impl<'l> CelCompiler<'l> {
766759 Ok ( (
767760 ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: from_null( ) ) ] ) ,
768761 AstNode :: new (
769- Primary :: Literal ( Literal :: Null ) ,
762+ Primary :: Literal ( LiteralsAndKeywords :: NullLit ) ,
763+ start_loc,
764+ self . tokenizer . location ( ) ,
765+ ) ,
766+ ) )
767+ }
768+ Some ( Token :: NullType ) => {
769+ self . tokenizer . next ( ) ?;
770+ Ok ( (
771+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: null_type( ) ) ] ) ,
772+ AstNode :: new (
773+ Primary :: Literal ( LiteralsAndKeywords :: NullType ) ,
774+ start_loc,
775+ self . tokenizer . location ( ) ,
776+ ) ,
777+ ) )
778+ }
779+ Some ( Token :: Int ) => {
780+ self . tokenizer . next ( ) ?;
781+ Ok ( (
782+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: int_type( ) ) ] ) ,
783+ AstNode :: new (
784+ Primary :: Literal ( LiteralsAndKeywords :: Int ) ,
785+ start_loc,
786+ self . tokenizer . location ( ) ,
787+ ) ,
788+ ) )
789+ }
790+ Some ( Token :: Uint ) => {
791+ self . tokenizer . next ( ) ?;
792+ Ok ( (
793+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: uint_type( ) ) ] ) ,
794+ AstNode :: new (
795+ Primary :: Literal ( LiteralsAndKeywords :: Uint ) ,
796+ start_loc,
797+ self . tokenizer . location ( ) ,
798+ ) ,
799+ ) )
800+ }
801+ Some ( Token :: Float ) => {
802+ self . tokenizer . next ( ) ?;
803+ Ok ( (
804+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: float_type( ) ) ] ) ,
805+ AstNode :: new (
806+ Primary :: Literal ( LiteralsAndKeywords :: Float ) ,
807+ start_loc,
808+ self . tokenizer . location ( ) ,
809+ ) ,
810+ ) )
811+ }
812+ Some ( Token :: Bool ) => {
813+ self . tokenizer . next ( ) ?;
814+ Ok ( (
815+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: bool_type( ) ) ] ) ,
816+ AstNode :: new (
817+ Primary :: Literal ( LiteralsAndKeywords :: Bool ) ,
818+ start_loc,
819+ self . tokenizer . location ( ) ,
820+ ) ,
821+ ) )
822+ }
823+ Some ( Token :: Timestamp ) => {
824+ self . tokenizer . next ( ) ?;
825+ Ok ( (
826+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: timestamp_type( ) ) ] ) ,
827+ AstNode :: new (
828+ Primary :: Literal ( LiteralsAndKeywords :: Timestamp ) ,
829+ start_loc,
830+ self . tokenizer . location ( ) ,
831+ ) ,
832+ ) )
833+ }
834+ Some ( Token :: Duration ) => {
835+ self . tokenizer . next ( ) ?;
836+ Ok ( (
837+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: duration_type( ) ) ] ) ,
838+ AstNode :: new (
839+ Primary :: Literal ( LiteralsAndKeywords :: Duration ) ,
840+ start_loc,
841+ self . tokenizer . location ( ) ,
842+ ) ,
843+ ) )
844+ }
845+ Some ( Token :: String ) => {
846+ self . tokenizer . next ( ) ?;
847+ Ok ( (
848+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: string_type( ) ) ] ) ,
849+ AstNode :: new (
850+ Primary :: Literal ( LiteralsAndKeywords :: String ) ,
851+ start_loc,
852+ self . tokenizer . location ( ) ,
853+ ) ,
854+ ) )
855+ }
856+ Some ( Token :: Type ) => {
857+ self . tokenizer . next ( ) ?;
858+ Ok ( (
859+ ParseResult :: with_bytecode ( vec ! [ ByteCode :: Push ( CelValue :: type_type( ) ) ] ) ,
860+ AstNode :: new (
861+ Primary :: Literal ( LiteralsAndKeywords :: Type ) ,
770862 start_loc,
771863 self . tokenizer . location ( ) ,
772864 ) ,
0 commit comments