@@ -15,10 +15,10 @@ namespace SER.Code.ContextSystem;
1515/// </summary>
1616public static class Contexter
1717{
18- public static TryGet < Context [ ] > ContextLines ( Line [ ] lines , Script scr )
18+ public static TryGet < RunnableContext [ ] > ContextLines ( Line [ ] lines , Script scr )
1919 {
2020 Stack < StatementContext > statementStack = [ ] ;
21- List < Context > contexts = [ ] ;
21+ List < RunnableContext > contexts = [ ] ;
2222
2323 List < Result > errors = [ ] ;
2424 foreach ( var line in lines )
@@ -47,10 +47,10 @@ public static TryGet<Context[]> ContextLines(Line[] lines, Script scr)
4747 }
4848
4949 private static Result TryAddResult (
50- Context context ,
50+ RunnableContext context ,
5151 uint lineNum ,
5252 Stack < StatementContext > statementStack ,
53- List < Context > contexts
53+ List < RunnableContext > contexts
5454 ) {
5555 Result rs = $ "Invalid context { context } ";
5656
@@ -129,19 +129,20 @@ List<Context> contexts
129129 return true ;
130130 }
131131
132- public static TryGet < Context ? > ContextLine ( BaseToken [ ] tokens , uint ? lineNum , Script scr )
132+ public static TryGet < RunnableContext ? > ContextLine ( BaseToken [ ] tokens , uint ? lineNum , Script scr )
133133 {
134134 Result rs = $ "Line { ( lineNum . HasValue ? $ "{ lineNum . Value } " : "" ) } is invalid";
135135
136136 var firstToken = tokens . FirstOrDefault ( ) ;
137- if ( firstToken is null ) return null as Context ;
137+ if ( firstToken is null ) return null as RunnableContext ;
138138
139139 if ( firstToken is not IContextableToken contextable )
140140 {
141141 return $ "'{ firstToken . RawRep } ' is not a valid way to start a line. Perhaps you made a typo?";
142142 }
143143
144144 var context = contextable . GetContext ( scr ) ;
145+ if ( context is null ) return context ;
145146
146147 foreach ( var token in tokens . Skip ( 1 ) )
147148 {
@@ -154,7 +155,7 @@ List<Context> contexts
154155 return context ;
155156 }
156157
157- private static Result HandleCurrentContext ( BaseToken token , Context context , out bool endLineContexting )
158+ private static Result HandleCurrentContext ( BaseToken token , RunnableContext context , out bool endLineContexting )
158159 {
159160 Result rs = $ "Cannot add '{ token . RawRep } ' to { context } ";
160161 Log . Debug ( $ "Handling token { token } in context { context } ") ;
0 commit comments