Skip to content

Commit fc024f9

Browse files
committed
Test so that data and procedure are not enforced
1 parent 939288e commit fc024f9

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/aux/aux_compile_line.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void compile_line(vector<string> &tokens, compiler_state &state)
1111
// include
1212
if (line_like("INCLUDE $string", tokens, state))
1313
{
14-
if (state.section_state != 0)
14+
if (false && state.section_state != 0)
1515
badcode(
1616
"you can only use the INCLUDE statement before the DATA and "
1717
"PROCEDURE sections",
@@ -38,7 +38,7 @@ void compile_line(vector<string> &tokens, compiler_state &state)
3838
// extension (INCLUDE but for c++ extensions)
3939
if (line_like("EXTENSION $string", tokens, state))
4040
{
41-
if (state.section_state != 0)
41+
if (false && state.section_state != 0)
4242
badcode(
4343
"you can only use the EXTENSION statement before the DATA and "
4444
"PROCEDURE sections",
@@ -62,7 +62,7 @@ void compile_line(vector<string> &tokens, compiler_state &state)
6262
// extension flags (for the C++ compiler)
6363
if (line_like("FLAG $string", tokens, state))
6464
{
65-
if (state.section_state != 0)
65+
if (false && state.section_state != 0)
6666
badcode(
6767
"you can only use the FLAG statement before the DATA and PROCEDURE "
6868
"sections",
@@ -77,7 +77,7 @@ void compile_line(vector<string> &tokens, compiler_state &state)
7777
// os-specific extension flags
7878
if (line_like("FLAG $name $string", tokens, state))
7979
{
80-
if (state.section_state != 0)
80+
if (false && state.section_state != 0)
8181
badcode(
8282
"you can only use the FLAG statement before the DATA and PROCEDURE "
8383
"sections",
@@ -253,16 +253,16 @@ void compile_line(vector<string> &tokens, compiler_state &state)
253253
}
254254
if (valid_type && i >= tokens.size() - 1)
255255
{
256-
if (state.section_state != 1 && state.section_state != 4)
256+
/*if (state.section_state != 1 && state.section_state != 4)
257257
badcode(
258258
"Variable declaration outside DATA, PARAMETERS or LOCAL DATA "
259259
"section",
260-
state.where);
260+
state.where);*/
261261
if (state.variables[state.current_subprocedure].count(tokens[0]) > 0)
262262
badcode("Duplicate declaration for variable \"" + tokens[0] + "\"",
263263
state.where);
264264
state.variables[state.current_subprocedure][tokens[0]] = type_number;
265-
if (state.section_state == 1)
265+
if (state.section_state != 4)
266266
{ // DATA or LOCAL DATA
267267
string identifier = fix_identifier(tokens[0], true, state);
268268
string type = state.get_c_type(type_number);

src/aux/aux_state.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ bool in_procedure_section(compiler_state &state) {
146146
state.section_state = 2;
147147
open_subprocedure_code(state);
148148
}
149-
return state.section_state == 2;
149+
//return state.section_state == 2;
150+
return true;
150151
}
151152

152153
vector<unsigned int> variable_type(string &token, compiler_state &state) {

src/ldpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ int main(int argc, const char *argv[])
280280
accept_and_compile(state);
281281
}
282282
// Fail if no procedure section was found
283-
if (state.section_state < 2)
283+
/*if (state.section_state < 2)
284284
error("PROCEDURE section not found" +
285-
(filename == "-c" ? "." : " in file '" + filename + "'."));
285+
(filename == "-c" ? "." : " in file '" + filename + "'."));*/
286286
}
287287

288288
// Add return code to the generated main function

0 commit comments

Comments
 (0)