File tree Expand file tree Collapse file tree 6 files changed +37
-7
lines changed Expand file tree Collapse file tree 6 files changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ infixAssertion = attributePath SP infixAssertionOperator SP infixAssertionValue
2222infixAssertionOperator  =  " eq"   /  " ne"   /  " co"   /  " sw"   /  " ew"   /  " gt"   /  " lt"   /  " ge"   /  " le" 
2323infixAssertionValue  =  null  /  true  /  false  /  number  /  string 
2424
25- attributePath  =  [URI  " : "  ] attributePathSegment  * 1(" ."   attributePathSegment )
25+ attributePath  =  [URI  " < "  ] attributePathSegment  * 1(" ."   attributePathSegment )
2626attributePathSegment   =  ALPHA  * (" -"   /  " _"   /  DIGIT  /  ALPHA )
2727
2828;  rfc7159
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ class TrackMap {
3737  infixAssertionValue  =  [ ]  as  ( null  |  boolean  |  number  |  string ) [ ] ; 
3838  attributePath  =  [ ]  as  string [ ] [ ] ; 
3939  attributePathSegment  =  [ ]  as  string [ ] ; 
40+   uri  =  [ ]  as  string [ ] ; 
4041} 
4142
4243class  Stat  { 
@@ -57,6 +58,7 @@ class Stat {
5758  infixAssertionValue  =  0  as  number ; 
5859  attributePath  =  0  as  number ; 
5960  attributePathSegment  =  0  as  number ; 
61+   uri  =  0  as  number ; 
6062} 
6163
6264class  StatsMap  { 
@@ -77,6 +79,7 @@ class StatsMap {
7779  infixAssertionValue  =  [ ]  as  Stat [ ] ; 
7880  attributePath  =  [ ]  as  Stat [ ] ; 
7981  attributePathSegment  =  [ ]  as  Stat [ ] ; 
82+   uri  =  [ ]  as  Stat [ ] ; 
8083} 
8184
8285export  class  Yard  { 
Original file line number Diff line number Diff line change @@ -14,15 +14,17 @@ export function attributePath(
1414      break ; 
1515
1616    case  ids . SEM_POST :
17-       const  {  attributePathSegment }  =  yard . post ( "attributePath" ) ; 
17+       const  {  attributePathSegment,  uri  }  =  yard . post ( "attributePath" ) ; 
1818
1919      if  ( attributePathSegment . length  <  1 )  { 
2020        throw  new  Error ( 
2121          `INVARIANT: Expected 1 or more attributePathSegment, but got ${ attributePathSegment . length }  ;` 
2222        ) ; 
2323      } 
24- 
25-       yard . tracks . attributePath . push ( attributePathSegment . reverse ( ) ) ; 
24+       yard . tracks . attributePath . push ( [ 
25+         ...uri , 
26+         ...attributePathSegment . reverse ( ) 
27+       ] ) ; 
2628      break ; 
2729  } 
2830
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { infixAssertionOperator } from "./infixAssertionOperator";
2020import  {  infixAssertionValue  }  from  "./infixAssertionValue" ; 
2121import  {  attributePath  }  from  "./attributePath" ; 
2222import  {  attributePathSegment  }  from  "./attributePathSegment" ; 
23+ import  {  uri  }  from  "./uri" ; 
2324
2425const  grammar  =  new  Grammar ( ) ; 
2526const  parser  =  new  Parser ( ) ; 
@@ -54,7 +55,8 @@ parser.ast.callbacks = {
5455  infixAssertionOperator, 
5556  infixAssertionValue, 
5657  attributePath, 
57-   attributePathSegment
58+   attributePathSegment, 
59+   uri
5860} ; 
5961
6062export  function  compilePath ( input : string ) : SimplePath  |  FilterPath  { 
Original file line number Diff line number Diff line change 1+ import  {  ids ,  utils  }  from  "apg-lib" ; 
2+ import  {  Yard  }  from  "./Yard" ; 
3+ 
4+ export  function  uri ( 
5+   state : typeof  ids . SEM_PRE  |  typeof  ids . SEM_POST , 
6+   chars : number [ ] , 
7+   phraseIndex : number , 
8+   phraseLength : number , 
9+   yard : Yard 
10+ ) : typeof  ids . SEM_OK  |  typeof  ids . SEM_SKIP  { 
11+   switch  ( state )  { 
12+     case  ids . SEM_PRE :
13+       break ; 
14+ 
15+     case  ids . SEM_POST :
16+       yard . tracks . uri . push ( 
17+         utils . charsToString ( chars ,  phraseIndex ,  phraseLength ) 
18+       ) ; 
19+       break ; 
20+   } 
21+ 
22+   return  ids . SEM_OK ; 
23+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments