Ejemplo n.º 1
0
 internal static SymbolTable CreatePathSymbols(SymbolTable symbols, IEnumerable <String> fragments)
 {
     return(((SymbolTableExpression)EnumerableEx.Generate(
                 Tuple.Create(fragments, symbols.ResolveModule()),
                 _ => _.Item1.Any(),
                 _ => Tuple.Create(_.Item1.Skip(1), _.Item1.First()
                                   .Let(f => _.Item2.ExistsKey(f) && _.Item2.Resolve(f) is SymbolTableExpression
                 ? ((SymbolTableExpression)_.Item2.Resolve(f)).Symbols
                 : new SymbolTable().Apply(
                                            s => s.MarkAsModule(),
                                            s => _.Item2[f] = YacqExpression.SymbolTable(s)
                                            )
                                        )),
                 _ => _.Item2
                 ).Last().Resolve(fragments.Last())).Symbols);
 }