Go to repository

Type Alias SourceInput

SourceInput: string | Record<string, string> | string[]

A Source Input is composed of one or more 'documents', that may be obtained (and identified) in different ways: e.g. from files, web-services, or command line arguments, etc. The type SourceInput establishes the different kinds of input a SourceReader accepts to read, independently of how it was obtained.

  • A single string represents a unique unnamed source document, for example as that coming from a command line argument, e.g.
    'program { }'
    
  • The Record represents different source documents identified by a name, for example, different filenames and their contents, e.g.
     {
    'foo.gbs': 'program { P() }',
    'bar.gbs': 'procedure P() {}',
    }
  • The array of strings represents different source documents with no identification, for example, as it may come from a command line with one or more arguments and optional configuration defaults, e.g.
    [ 'procedure P() { }',  'program { P() }' ]
    

An input instance of SourceInput is used in the creation of SourceReaders, typically as

new SourceReader(input, '\n');