@@ -526,40 +526,77 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
526
526
}
527
527
528
528
final public void AddAttribute (NodeAttributes attributes ) throws ParseException {Token attr = null ;
529
+ Token key = null ;
529
530
Token value = null ;
530
531
Token attrType = null ;
531
532
switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
533
+ case ALIGNRELN :
532
534
case IDENTIFIER :{
533
- attr = jj_consume_token (IDENTIFIER );
534
535
switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
535
- case 10 :{
536
- attrType = jj_consume_token (10 );
537
- break ;
536
+ case IDENTIFIER :{
537
+ attr = jj_consume_token (IDENTIFIER );
538
+ switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
539
+ case 10 :{
540
+ attrType = jj_consume_token (10 );
541
+ break ;
542
+ }
543
+ case 22 :{
544
+ attrType = jj_consume_token (22 );
545
+ break ;
546
+ }
547
+ default :
548
+ jj_la1 [23 ] = jj_gen ;
549
+ jj_consume_token (-1 );
550
+ throw new ParseException ();
538
551
}
539
- case 22 :{
540
- attrType = jj_consume_token (22 );
541
- break ;
552
+ switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
553
+ case IDENTIFIER :{
554
+ value = jj_consume_token (IDENTIFIER );
555
+ break ;
556
+ }
557
+ case REGEX :{
558
+ value = jj_consume_token (REGEX );
559
+ break ;
560
+ }
561
+ default :
562
+ jj_la1 [24 ] = jj_gen ;
563
+ jj_consume_token (-1 );
564
+ throw new ParseException ();
542
565
}
543
- default :
544
- jj_la1 [23 ] = jj_gen ;
545
- jj_consume_token (-1 );
546
- throw new ParseException ();
547
- }
548
- switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
549
- case IDENTIFIER :{
550
- value = jj_consume_token (IDENTIFIER );
551
566
break ;
552
567
}
553
- case REGEX :{
554
- value = jj_consume_token (REGEX );
568
+ case ALIGNRELN :{
569
+ attrType = jj_consume_token (ALIGNRELN );
570
+ key = jj_consume_token (IDENTIFIER );
571
+ jj_consume_token (21 );
572
+ switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
573
+ case IDENTIFIER :{
574
+ value = jj_consume_token (IDENTIFIER );
575
+ break ;
576
+ }
577
+ case REGEX :{
578
+ value = jj_consume_token (REGEX );
579
+ break ;
580
+ }
581
+ default :
582
+ jj_la1 [25 ] = jj_gen ;
583
+ jj_consume_token (-1 );
584
+ throw new ParseException ();
585
+ }
555
586
break ;
556
587
}
557
588
default :
558
- jj_la1 [24 ] = jj_gen ;
589
+ jj_la1 [26 ] = jj_gen ;
559
590
jj_consume_token (-1 );
560
591
throw new ParseException ();
561
592
}
562
- if (attr != null && value != null ) {
593
+ if (attrType .image .equals ("@" )) {
594
+ if (attr == null || key == null || value == null ) {
595
+ {if (true ) throw new SemgrexParseException ("null while parsing semgrex expression: attr=" + attr +
596
+ " key=" + key + " value=" + value );}
597
+ }
598
+ attributes .addContains (attr .image , key .image , value .image );
599
+ } else if (attr != null && value != null ) {
563
600
boolean negated = attrType .image .equals ("!:" );
564
601
attributes .setAttribute (attr .image , value .image , negated );
565
602
}
@@ -576,7 +613,7 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
576
613
break ;
577
614
}
578
615
default :
579
- jj_la1 [25 ] = jj_gen ;
616
+ jj_la1 [27 ] = jj_gen ;
580
617
jj_consume_token (-1 );
581
618
throw new ParseException ();
582
619
}
@@ -588,6 +625,7 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
588
625
NodePattern pat ;
589
626
jj_consume_token (23 );
590
627
switch ((jj_ntk ==-1 )?jj_ntk_f ():jj_ntk ) {
628
+ case ALIGNRELN :
591
629
case IDENTIFIER :
592
630
case EMPTY :
593
631
case ROOT :{
@@ -600,7 +638,7 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
600
638
break ;
601
639
}
602
640
default :
603
- jj_la1 [26 ] = jj_gen ;
641
+ jj_la1 [28 ] = jj_gen ;
604
642
break label_6 ;
605
643
}
606
644
jj_consume_token (24 );
@@ -609,7 +647,7 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
609
647
break ;
610
648
}
611
649
default :
612
- jj_la1 [27 ] = jj_gen ;
650
+ jj_la1 [29 ] = jj_gen ;
613
651
;
614
652
}
615
653
jj_consume_token (25 );
@@ -629,7 +667,7 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
629
667
break ;
630
668
}
631
669
default :
632
- jj_la1 [28 ] = jj_gen ;
670
+ jj_la1 [30 ] = jj_gen ;
633
671
;
634
672
}
635
673
pat = new NodePattern (r , underNodeNegation , attributes , link , name != null ? name .image : null );
@@ -646,13 +684,13 @@ final public SemgrexPattern Root() throws ParseException {// Root pattern for th
646
684
public Token jj_nt ;
647
685
private int jj_ntk ;
648
686
private int jj_gen ;
649
- final private int [] jj_la1 = new int [29 ];
687
+ final private int [] jj_la1 = new int [31 ];
650
688
static private int [] jj_la1_0 ;
651
689
static {
652
690
jj_la1_init_0 ();
653
691
}
654
692
private static void jj_la1_init_0 () {
655
- jj_la1_0 = new int [] {0x400 ,0x828808 ,0x3801c ,0x3801c ,0x828800 ,0x2000 ,0x3c01c ,0x4000 ,0x3801c ,0x2001c ,0x80000 ,0x10 ,0x110 ,0x110 ,0x100000 ,0x200000 ,0x1c ,0x828800 ,0x2000 ,0x82c000 ,0x4000 ,0x828000 ,0x820000 ,0x400400 ,0x110 ,0xd0 , 0x1000000 ,0xd0 ,0x200000 ,};
693
+ jj_la1_0 = new int [] {0x400 ,0x828808 ,0x3801c ,0x3801c ,0x828800 ,0x2000 ,0x3c01c ,0x4000 ,0x3801c ,0x2001c ,0x80000 ,0x10 ,0x110 ,0x110 ,0x100000 ,0x200000 ,0x1c ,0x828800 ,0x2000 ,0x82c000 ,0x4000 ,0x828000 ,0x820000 ,0x400400 ,0x110 ,0x110 , 0x18 , 0xd8 , 0x1000000 ,0xd8 ,0x200000 ,};
656
694
}
657
695
658
696
/** Constructor with InputStream. */
@@ -666,7 +704,7 @@ public SemgrexParser(java.io.InputStream stream, String encoding) {
666
704
token = new Token ();
667
705
jj_ntk = -1 ;
668
706
jj_gen = 0 ;
669
- for (int i = 0 ; i < 29 ; i ++) jj_la1 [i ] = -1 ;
707
+ for (int i = 0 ; i < 31 ; i ++) jj_la1 [i ] = -1 ;
670
708
}
671
709
672
710
/** Reinitialise. */
@@ -680,7 +718,7 @@ public void ReInit(java.io.InputStream stream, String encoding) {
680
718
token = new Token ();
681
719
jj_ntk = -1 ;
682
720
jj_gen = 0 ;
683
- for (int i = 0 ; i < 29 ; i ++) jj_la1 [i ] = -1 ;
721
+ for (int i = 0 ; i < 31 ; i ++) jj_la1 [i ] = -1 ;
684
722
}
685
723
686
724
/** Constructor. */
@@ -690,7 +728,7 @@ public SemgrexParser(java.io.Reader stream) {
690
728
token = new Token ();
691
729
jj_ntk = -1 ;
692
730
jj_gen = 0 ;
693
- for (int i = 0 ; i < 29 ; i ++) jj_la1 [i ] = -1 ;
731
+ for (int i = 0 ; i < 31 ; i ++) jj_la1 [i ] = -1 ;
694
732
}
695
733
696
734
/** Reinitialise. */
@@ -708,7 +746,7 @@ public void ReInit(java.io.Reader stream) {
708
746
token = new Token ();
709
747
jj_ntk = -1 ;
710
748
jj_gen = 0 ;
711
- for (int i = 0 ; i < 29 ; i ++) jj_la1 [i ] = -1 ;
749
+ for (int i = 0 ; i < 31 ; i ++) jj_la1 [i ] = -1 ;
712
750
}
713
751
714
752
/** Constructor with generated Token Manager. */
@@ -717,7 +755,7 @@ public SemgrexParser(SemgrexParserTokenManager tm) {
717
755
token = new Token ();
718
756
jj_ntk = -1 ;
719
757
jj_gen = 0 ;
720
- for (int i = 0 ; i < 29 ; i ++) jj_la1 [i ] = -1 ;
758
+ for (int i = 0 ; i < 31 ; i ++) jj_la1 [i ] = -1 ;
721
759
}
722
760
723
761
/** Reinitialise. */
@@ -726,7 +764,7 @@ public void ReInit(SemgrexParserTokenManager tm) {
726
764
token = new Token ();
727
765
jj_ntk = -1 ;
728
766
jj_gen = 0 ;
729
- for (int i = 0 ; i < 29 ; i ++) jj_la1 [i ] = -1 ;
767
+ for (int i = 0 ; i < 31 ; i ++) jj_la1 [i ] = -1 ;
730
768
}
731
769
732
770
private Token jj_consume_token (int kind ) throws ParseException {
@@ -782,7 +820,7 @@ public ParseException generateParseException() {
782
820
la1tokens [jj_kind ] = true ;
783
821
jj_kind = -1 ;
784
822
}
785
- for (int i = 0 ; i < 29 ; i ++) {
823
+ for (int i = 0 ; i < 31 ; i ++) {
786
824
if (jj_la1 [i ] == jj_gen ) {
787
825
for (int j = 0 ; j < 32 ; j ++) {
788
826
if ((jj_la1_0 [i ] & (1 <<j )) != 0 ) {
0 commit comments