File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -209,6 +209,31 @@ var tokenElse
209209 }
210210 }
211211
212+ public static IEnumerable < Token > GetTokens ( Ast outerAst , Ast innerAst , Token [ ] outerTokens )
213+ {
214+ ThrowIfNull ( outerAst , nameof ( outerAst ) ) ;
215+ ThrowIfNull ( innerAst , nameof ( innerAst ) ) ;
216+ ThrowIfNull ( outerTokens , nameof ( outerTokens ) ) ;
217+
218+ // check if inner ast belongs in outerAst
219+ var foundAst = outerAst . Find ( x => x . Equals ( innerAst ) , true ) ;
220+ if ( foundAst == null )
221+ {
222+ // todo localize
223+ throw new ArgumentException ( String . Format ( "innerAst cannot be found within outerAst" ) ) ;
224+ }
225+
226+ var tokenOps = new TokenOperations ( outerTokens , outerAst ) ;
227+ return tokenOps . GetTokens ( innerAst ) ;
228+ }
229+
230+ private static void ThrowIfNull < T > ( T param , string paramName )
231+ {
232+ if ( param == null )
233+ {
234+ throw new ArgumentNullException ( paramName ) ;
235+ }
236+ }
212237 private IEnumerable < Token > GetTokens ( Ast ast )
213238 {
214239 int k = 0 ;
You can’t perform that action at this time.
0 commit comments