(tree: ISyntaxTree)
| 19 | } |
| 20 | |
| 21 | function toStructure(tree: ISyntaxTree): IStructure { |
| 22 | const {block, left, lexeme, right, value} = tree; |
| 23 | |
| 24 | const res: IStructure = { |
| 25 | subType: lexeme.subType, |
| 26 | type: lexeme.type, |
| 27 | value: lexeme.present ? lexeme.present(tree) : value |
| 28 | }; |
| 29 | |
| 30 | if (block) { |
| 31 | res.block = toStructure(block); |
| 32 | } |
| 33 | |
| 34 | if (left) { |
| 35 | res.left = toStructure(left); |
| 36 | } |
| 37 | |
| 38 | if (right) { |
| 39 | res.right = toStructure(right); |
| 40 | } |
| 41 | |
| 42 | return res; |
| 43 | } |
| 44 | |
| 45 | export default class SyntaxTree { |
| 46 | protected lexerResult: ILexerResult; |
no outgoing calls
no test coverage detected
searching dependent graphs…