379
379
(templatel--parser-_ scanner)
380
380
(templatel--join-chars m)))
381
381
382
- (defun templatel--token- || (scanner)
383
- " Read '||' off SCANNER's input."
384
- (let ((m (templatel--scanner-matchs scanner " ||" )))
385
- (templatel--parser-_ scanner)
386
- (templatel--join-chars m)))
387
-
388
382
(defun templatel--token-+ (scanner )
389
383
" Read '+' off SCANNER's input."
390
384
(let ((m (templatel--scanner-matchs scanner " +" )))
463
457
(templatel--parser-_ scanner)
464
458
(templatel--join-chars m)))
465
459
466
- (defun templatel--token-<< (scanner )
467
- " Read '<<' off SCANNER's input."
468
- (let ((m (templatel--scanner-matchs scanner " <<" )))
469
- (templatel--parser-_ scanner)
470
- (templatel--join-chars m)))
471
-
472
- (defun templatel--token->> (scanner )
473
- " Read '>>' off SCANNER's input."
474
- (let ((m (templatel--scanner-matchs scanner " >>" )))
475
- (templatel--parser-_ scanner)
476
- (templatel--join-chars m)))
477
-
478
- (defun templatel--token-& (scanner )
479
- " Read '&' off SCANNER's input."
480
- (let ((m (templatel--scanner-matchs scanner " &" )))
481
- (templatel--parser-_ scanner)
482
- (templatel--join-chars m)))
483
-
484
- (defun templatel--token-~ (scanner )
485
- " Read '~' off SCANNER's input."
486
- (let ((m (templatel--scanner-matchs scanner " ~" )))
487
- (templatel--parser-_ scanner)
488
- (templatel--join-chars m)))
489
-
490
460
(defun templatel--token-% (scanner )
491
461
" Read '%' off SCANNER's input."
492
462
; ; This is needed or allowing a cutting point to be introduced right
730
700
" Unclosed bracket" )
731
701
(cons " Expression" (list expr))))
732
702
733
- ; ; GR: Expr <- Filter
703
+ ; ; GR: Expr <- Logical
734
704
(defun templatel--parser-expr (scanner )
735
705
" Read an expression from SCANNER."
736
706
(cons
737
707
" Expr"
738
- (list (templatel--parser-filter scanner))))
708
+ (list (templatel--parser-logical scanner))))
739
709
740
710
(defun templatel--parser-cut (scanner fn msg )
741
711
" Try to parse FN off SCANNER or error with MSG.
@@ -784,47 +754,27 @@ operator (RATORFN)."
784
754
(lambda () (funcall randfn scanner))
785
755
" Missing operand after binary operator" ))))))
786
756
787
- ; ; GR: Filter <- Logical (_PIPE Logical)*
788
- (defun templatel--parser-filter (scanner )
789
- " Read Filter from SCANNER."
790
- (templatel--parser-binary scanner " Filter" #'templatel--parser-logical #'templatel--token- |))
791
-
792
- ; ; GR: Logical <- BitLogical ((AND / OR) BitLogical)*
757
+ ; ; GR: Logical <- Comparison ((AND / OR) Comparison)*
793
758
(defun templatel--parser-logical (scanner )
794
759
" Read Logical from SCANNER."
795
760
(templatel--parser-binary
796
761
scanner
797
762
nil ; "Logical"
798
- #'templatel--parser-bit-logical
763
+ #'templatel--parser-comparison
799
764
(lambda (s )
800
765
(templatel--scanner-or
801
766
s
802
767
(list
803
768
(lambda () (templatel--token-and s))
804
769
(lambda () (templatel--token-or s)))))))
805
770
806
- ; ; GR: BitLogical <- Comparison ((BAND / BXOR / BOR) Comparison)*
807
- (defun templatel--parser-bit-logical (scanner )
808
- " Read BitLogical from SCANNER."
809
- (templatel--parser-binary
810
- scanner
811
- nil ; "BitLogical"
812
- #'templatel--parser-comparison
813
- (lambda (s )
814
- (templatel--scanner-or
815
- s
816
- (list
817
- (lambda () (templatel--token-& s))
818
- (lambda () (templatel--token-^ s))
819
- (lambda () (templatel--token-|| s)))))))
820
-
821
- ; ; GR: Comparison <- BitShifting ((EQ / NEQ / LTE / GTE / LT / GT / IN) BitShifting)*
771
+ ; ; GR: Comparison <- Term ((EQ / NEQ / LTE / GTE / LT / GT / IN) Term)*
822
772
(defun templatel--parser-comparison (scanner )
823
773
" Read a Comparison from SCANNER."
824
774
(templatel--parser-binary
825
775
scanner
826
776
nil ; "Comparison"
827
- #'templatel--parser-bit-shifting
777
+ #'templatel--parser-term
828
778
(lambda (s )
829
779
(templatel--scanner-or
830
780
s
@@ -837,20 +787,6 @@ operator (RATORFN)."
837
787
(lambda () (templatel--token-> s))
838
788
(lambda () (templatel--token-in s)))))))
839
789
840
- ; ; GR: BitShifting <- Term ((RSHIFT / LSHIFT) Term)*
841
- (defun templatel--parser-bit-shifting (scanner )
842
- " Read a BitShifting from SCANNER."
843
- (templatel--parser-binary
844
- scanner
845
- nil ; "BitShifting"
846
- #'templatel--parser-term
847
- (lambda (s )
848
- (templatel--scanner-or
849
- s
850
- (list
851
- (lambda () (templatel--token->> s))
852
- (lambda () (templatel--token-<< s)))))))
853
-
854
790
; ; GR: Term <- Factor ((PLUS / MINUS) Factor)*
855
791
(defun templatel--parser-term (scanner )
856
792
" Read Term from SCANNER."
@@ -880,20 +816,28 @@ operator (RATORFN)."
880
816
(lambda () (templatel--token-slash s))
881
817
(lambda () (templatel--token-dslash s)))))))
882
818
883
- ; ; GR: Power <- Unary ((POWER / MOD) Unary )*
819
+ ; ; GR: Power <- Filter ((POWER / MOD) Filter )*
884
820
(defun templatel--parser-power (scanner )
885
821
" Read Power from SCANNER."
886
822
(templatel--parser-binary
887
823
scanner
888
824
nil ; "Power"
889
- #'templatel--parser-unary
825
+ #'templatel--parser-filter
890
826
(lambda (s )
891
827
(templatel--scanner-or
892
828
s
893
829
(list
894
830
(lambda () (templatel--token-** s))
895
831
(lambda () (templatel--token-% s)))))))
896
832
833
+ ; ; GR: Filter <- Unary (_PIPE Unary)*
834
+ (defun templatel--parser-filter (scanner )
835
+ " Read Filter from SCANNER."
836
+ (templatel--parser-binary
837
+ scanner
838
+ " Filter"
839
+ #'templatel--parser-unary #'templatel--token- |))
840
+
897
841
; ; GR: UnaryOp <- PLUS / MINUS / NOT / BNOT
898
842
(defun templatel--parser-unary-op (scanner )
899
843
" Read an Unary operator from SCANNER."
@@ -902,7 +846,6 @@ operator (RATORFN)."
902
846
(list
903
847
(lambda () (templatel--token-+ scanner))
904
848
(lambda () (templatel--token-- scanner))
905
- (lambda () (templatel--token-~ scanner))
906
849
(lambda () (templatel--token-not scanner)))))
907
850
908
851
; ; GR: Unary <- UnaryOp Unary / UnaryOp Primary / Primary
@@ -1660,10 +1603,6 @@ Otherwise its HTML entities are escaped."
1660
1603
; ; Logic
1661
1604
(" and" and)
1662
1605
(" or" or)
1663
- ; ; Bit Logic
1664
- (" &" logand)
1665
- (" ||" logior)
1666
- (" ^" logxor)
1667
1606
; ; Comparison
1668
1607
(" <" < )
1669
1608
(" >" > )
0 commit comments