Function
parseFile
(
path: string,
src: string,
getUid: () => string = defaultSymbolForge.getUid.bind( defaultSymbolForge ),
isEntry: boolean = false
)
Source from the content-addressed store, hash-verified
| 14 | } |
| 15 | |
| 16 | export function parseFile( |
| 17 | path: string, |
| 18 | src: string, |
| 19 | getUid: () => string = defaultSymbolForge.getUid.bind( defaultSymbolForge ), |
| 20 | isEntry: boolean = false |
| 21 | ): Source |
| 22 | { |
| 23 | const [ source, diagnostics ] = Parser.parseFile( path, src, getUid, isEntry ); |
| 24 | if( diagnostics.length > 0 ) |
| 25 | { |
| 26 | throw new Error( |
| 27 | `Parsing errors:\n${ diagnostics.map( d => d.toString() ).join( "\n" ) }` |
| 28 | ); |
| 29 | } |
| 30 | return source; |
| 31 | } |
| 32 | |
| 33 | export function parseSource( src: Source ) |
| 34 | { |