@@ -1558,7 +1558,7 @@ function findSurfaceActorLinkIssues(
15581558 const surfaceBlocks = blocks . filter ( ( block ) => block . kind === "surface" ) ;
15591559 const referencedActors = new Set < string > ( ) ;
15601560 const forPattern =
1561- / ^ \s * f a c i n g \s + [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * \s * : \s * ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * $ / m;
1561+ / ^ \s * (?: f a c i n g | f o r ) \s + [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * \s * : \s * ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * $ / m;
15621562
15631563 for ( const surface of surfaceBlocks ) {
15641564 const match = surface . body . match ( forPattern ) ;
@@ -1645,17 +1645,17 @@ function findSurfaceBindingUsageIssues(
16451645 for ( const surface of surfaceBlocks ) {
16461646 const body = surface . body ;
16471647 const forMatch = body . match (
1648- / ^ \s * f a c i n g \s + ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * : \s * [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * (?: \s + w i t h \s + .+ ) ? \s * $ / m,
1648+ / ^ \s * (?: f a c i n g | f o r ) \s + ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * : \s * [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * (?: \s + w i t h \s + .+ ) ? \s * $ / m,
16491649 ) ;
16501650 const contextMatch = body . match (
16511651 / ^ \s * c o n t e x t \s + ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * : \s * [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * (?: \s + w i t h \s + .+ ) ? \s * $ / m,
16521652 ) ;
16531653 const bindings = [
16541654 ...( forMatch
1655- ? [ { name : forMatch [ 1 ] , source : "facing" , line : forMatch [ 0 ] } ]
1655+ ? [ { name : forMatch [ 1 ] , sourcePattern : "(?: facing|for)" , sourceLabel : "for ", line : forMatch [ 0 ] } ]
16561656 : [ ] ) ,
16571657 ...( contextMatch
1658- ? [ { name : contextMatch [ 1 ] , source : "context" , line : contextMatch [ 0 ] } ]
1658+ ? [ { name : contextMatch [ 1 ] , sourcePattern : "context" , sourceLabel : "context" , line : contextMatch [ 0 ] } ]
16591659 : [ ] ) ,
16601660 ] ;
16611661
@@ -1670,7 +1670,7 @@ function findSurfaceBindingUsageIssues(
16701670 }
16711671
16721672 const linePattern = new RegExp (
1673- `^\\s*${ binding . source } \\s+${ escapeRegex ( binding . name ) } \\s*:` ,
1673+ `^\\s*${ binding . sourcePattern } \\s+${ escapeRegex ( binding . name ) } \\s*:` ,
16741674 "m" ,
16751675 ) ;
16761676 const lineMatch = body . match ( linePattern ) ;
@@ -1688,7 +1688,7 @@ function findSurfaceBindingUsageIssues(
16881688 absoluteOffset ,
16891689 absoluteOffset + binding . name . length ,
16901690 "allium.surface.unusedBinding" ,
1691- `Surface '${ surface . name } ' binding '${ binding . name } ' from '${ binding . source } ' is not used in the surface body.` ,
1691+ `Surface '${ surface . name } ' binding '${ binding . name } ' from '${ binding . sourceLabel } ' is not used in the surface body.` ,
16921692 "warning" ,
16931693 ) ,
16941694 ) ;
@@ -2972,7 +2972,7 @@ function collectTypeSchemas(
29722972 field = fieldPattern . exec ( body )
29732973 ) {
29742974 const name = field [ 1 ] ;
2975- const rhs = field [ 2 ] . trim ( ) ;
2975+ const rhs = field [ 2 ] . replace ( / \s * - - . * $ / , "" ) . trim ( ) ;
29762976 if (
29772977 / ^ [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * \s + f o r \s + t h i s \s + [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * $ / . test (
29782978 rhs ,
@@ -2994,6 +2994,10 @@ function collectTypeSchemas(
29942994 fields . set ( name , { typeName : genericMatch [ 2 ] , isCollection : true } ) ;
29952995 continue ;
29962996 }
2997+ if ( / ^ [ a - z _ ] [ a - z 0 - 9 _ ] * (?: \s * \| \s * [ a - z _ ] [ a - z 0 - 9 _ ] * ) + $ / . test ( cleaned ) ) {
2998+ fields . set ( name , { typeName : "__enum" , isCollection : false } ) ;
2999+ continue ;
3000+ }
29973001 const direct = cleaned . match ( / ^ ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) $ / ) ;
29983002 if ( direct ) {
29993003 fields . set ( name , { typeName : direct [ 1 ] , isCollection : false } ) ;
@@ -3032,7 +3036,7 @@ function collectRulePathSuffixes(
30323036function collectSurfaceBindingTypes ( body : string ) : Map < string , string > {
30333037 const bindings = new Map < string , string > ( ) ;
30343038 const patterns = [
3035- / ^ \s * f a c i n g \s + ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * : \s * ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) / m,
3039+ / ^ \s * (?: f a c i n g | f o r ) \s + ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * : \s * ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) / m,
30363040 / ^ \s * c o n t e x t \s + ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \s * : \s * ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) / m,
30373041 ] ;
30383042 for ( const pattern of patterns ) {
0 commit comments