@@ -11,13 +11,13 @@ bash_toml.do_parse() {
11
11
12
12
while IFS= read -rn 1 char; do
13
13
if bash_toml.is.newline " $char " ; then
14
- PARSER_LINE_NUMBER+=1
15
14
PARSER_COLUMN_NUMBER=0
15
+ PARSER_LINE_NUMBER+=1
16
16
else
17
17
PARSER_COLUMN_NUMBER+=1
18
18
fi
19
19
20
- bash_toml.debug
20
+ bash_toml.token_history_add
21
21
22
22
case " $mode " in
23
23
# State in which parser starts, and before any given TOML construct
@@ -27,10 +27,10 @@ bash_toml.do_parse() {
27
27
elif bash_toml.is.newline " $char " ; then
28
28
:
29
29
elif bash_toml.is.table " $char " ; then
30
- bash_toml.die " Tables are not supported"
30
+ bash_toml.parse_fail ' NOT_IMPLEMENTED ' " Tables are not supported"
31
31
return 1
32
32
elif bash_toml.is.double_quote " $char " ; then
33
- bash_toml.die " Quoted keys are not supported"
33
+ bash_toml.parse_fail ' NOT_IMPLEMENTED ' " Quoted keys are not supported"
34
34
return 1
35
35
elif bash_toml.is.valid_bare_key_char " $char " ; then
36
36
bash_toml.init_key_string " $char "
@@ -46,21 +46,21 @@ bash_toml.do_parse() {
46
46
:
47
47
elif bash_toml.is.newline " $char " ; then
48
48
# TODO: not being fired?
49
- bash_toml.die " Key name found without value 2"
49
+ bash_toml.parse_fail ' KEY_ABSENT ' " Key name found without value 2"
50
50
return 1
51
51
elif bash_toml.is.double_quote " $char " ; then
52
- bash_toml.die " Double quote values are not supported"
52
+ bash_toml.parse_fail ' NOT_IMPLEMENTED ' " Double quote values are not supported"
53
53
return 1
54
54
mode=' MODE_DOUBLEQUOTE_DURING_VALUE'
55
55
bash_toml.init_value_string
56
56
elif bash_toml.is.single_quote " $char " ; then
57
57
mode=' MODE_SINGLEQUOTE_DURING_VALUE'
58
58
bash_toml.init_value_string
59
59
elif bash_toml.is.empty " $char " ; then
60
- bash_toml.parse_fail ' INCOMPLETE_VALUE_ANY '
60
+ bash_toml.parse_fail ' VALUE_STRING_INVALID '
61
61
return 1
62
62
else
63
- bash_toml.die " Datetime, Boolean, Float, Integer, Array, Inline Table, etc. etc. Are not supported"
63
+ bash_toml.parse_fail ' NOT_IMPLEMENTED ' " Datetime, Boolean, Float, Integer, Array, Inline Table, etc. etc. Are not supported"
64
64
return 1
65
65
fi
66
66
;;
@@ -70,12 +70,12 @@ bash_toml.do_parse() {
70
70
elif bash_toml.is.equals_sign " $char " ; then
71
71
mode=' MODE_ANY_BEFORE_VALUE'
72
72
elif bash_toml.is.newline " $char " ; then
73
- bash_toml.die " Key name found without value"
73
+ bash_toml.parse_fail ' KEY_INVALID ' " Key name found without value"
74
74
return 1
75
75
elif bash_toml.is.valid_bare_key_char " $char " ; then
76
76
bash_toml.append_key_string " $char "
77
77
elif bash_toml.is.empty " $char " ; then
78
- bash_toml.parse_fail ' INCOMPLETE_KEY '
78
+ bash_toml.parse_fail ' KEY_INVALID '
79
79
return 1
80
80
else
81
81
bash_toml.parse_fail ' UNEXPECTED_BRANCH'
@@ -86,10 +86,10 @@ bash_toml.do_parse() {
86
86
if bash_toml.is.equals_sign " $char " ; then
87
87
mode=" MODE_ANY_BEFORE_VALUE"
88
88
elif bash_toml.is.empty " $char " ; then
89
- bash_toml.die " No equals sign found. End of file reached"
89
+ bash_toml.parse_fail ' UNEXPECTED_CHARACTER ' " No equals sign found. End of file reached"
90
90
return 1
91
91
else
92
- bash_toml.parse_fail ' INVALID_KEY '
92
+ bash_toml.parse_fail ' KEY_INVALID '
93
93
return 1
94
94
fi
95
95
;;
@@ -103,7 +103,7 @@ bash_toml.do_parse() {
103
103
if bash_toml.is.single_quote " $char " ; then
104
104
mode=' MODE_ANY_AFTER_VALUE'
105
105
elif bash_toml.is.newline " $char " ; then
106
- bash_toml.die " Newlines are not valid in single quote"
106
+ bash_toml.parse_fail ' VALUE_STRING_INVALID ' " Newlines are not valid in single quote"
107
107
return 1
108
108
else
109
109
bash_toml.append_value_string " $char "
@@ -117,7 +117,7 @@ bash_toml.do_parse() {
117
117
elif bash_toml.is.empty " $char " ; then
118
118
mode=' MODE_DEFAULT'
119
119
else
120
- bash_toml.die " Newline expected"
120
+ bash_toml.parse_fail ' UNEXPECTED_CHARACTER ' " Newline expected"
121
121
return 1
122
122
fi
123
123
;;
@@ -130,12 +130,12 @@ bash_toml.do_parse() {
130
130
:
131
131
;;
132
132
MODE_ANY_BEFORE_VALUE)
133
- bash_toml.die " Key name found without value theta"
133
+ bash_toml.parse_fail ' UNEXPECTED_BRANCH ' " Key name found without value theta"
134
134
return 1
135
135
;;
136
136
MODE_BAREKEY_DURING_KEY)
137
137
# i.g. `keyName`
138
- bash_toml.die " Key name found without value"
138
+ bash_toml.parse_fail ' UNEXPECTED_BRANCH ' " Key name found without value"
139
139
return 1
140
140
;;
141
141
MODE_EQUALS_BEFORE)
0 commit comments