-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.ts
57 lines (39 loc) · 1.34 KB
/
type.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { YamlDocument } from "../document"
import { ITypeFactory } from "../handler"
export abstract class TypeFactory implements ITypeFactory {
public document: YamlDocument
public onMappingStart(offset: number): any {
this.document.error("Unexpected value (mapping)", offset)
}
public onMappingEnd(mapping: any): any {
return mapping
}
public onMappingKey(offset: number, mapping: any, key: any, value: any): void {
mapping[key] = value
}
public onSequenceStart(offset: number): any {
this.document.error("Unexpected value (sequence)", offset)
}
public onSequenceEnd(sequence: any): any {
return sequence
}
public onSequenceEntry(offset: number, sequence: any, entry: any): void {
sequence.push(entry)
}
public onScalar(offset: number, value: string): any {
this.document.error("Unexpected value (scalar)", offset)
}
public onQuotedString(offset: number, value: string, quote: string): any {
this.document.error("Unexpected value (string)", offset)
}
public onBlockString(offset: number, value: string): any {
this.document.error("Unexpected value (string)", offset)
}
public onTagStart(offset: number, qname: string): TypeFactory {
this.document.error("Unexpected value (tag)", offset)
return null
}
public onTagEnd(value: any): any {
return value
}
}