Browse Source

Make -strict-style the default #871

gingerBill 4 years ago
parent
commit
898245431f
3 changed files with 7 additions and 17 deletions
  1. 0 1
      src/build_settings.cpp
  2. 2 6
      src/main.cpp
  3. 5 10
      src/parser.cpp

+ 0 - 1
src/build_settings.cpp

@@ -201,7 +201,6 @@ struct BuildContext {
 	bool   keep_object_files;
 	bool   keep_object_files;
 	bool   disallow_do;
 	bool   disallow_do;
 	bool   insert_semicolon;
 	bool   insert_semicolon;
-	bool   strict_style;
 
 
 	bool   ignore_warnings;
 	bool   ignore_warnings;
 	bool   warnings_as_errors;
 	bool   warnings_as_errors;

+ 2 - 6
src/main.cpp

@@ -1216,8 +1216,8 @@ bool parse_build_flags(Array<String> args) {
 							break;
 							break;
 
 
 						case BuildFlag_StrictStyle:
 						case BuildFlag_StrictStyle:
-							build_context.insert_semicolon = true;
-							build_context.strict_style = true;
+							gb_printf_err("-strict-style flag is not required any more\n");
+							bad_flags = true;
 							break;
 							break;
 
 
 
 
@@ -1802,10 +1802,6 @@ void print_show_help(String const arg0, String const &command) {
 		print_usage_line(2, "Inserts semicolons on newlines during tokenization using a basic rule");
 		print_usage_line(2, "Inserts semicolons on newlines during tokenization using a basic rule");
 		print_usage_line(0, "");
 		print_usage_line(0, "");
 
 
-		print_usage_line(1, "-strict-style");
-		print_usage_line(2, "Enforces code style stricter whilst parsing, requiring such things as trailing commas");
-		print_usage_line(0, "");
-
 		print_usage_line(1, "-ignore-warnings");
 		print_usage_line(1, "-ignore-warnings");
 		print_usage_line(2, "Ignores warning messages");
 		print_usage_line(2, "Ignores warning messages");
 		print_usage_line(0, "");
 		print_usage_line(0, "");

+ 5 - 10
src/parser.cpp

@@ -1232,13 +1232,10 @@ void comsume_comment_groups(AstFile *f, Token prev) {
 }
 }
 
 
 bool ignore_newlines(AstFile *f) {
 bool ignore_newlines(AstFile *f) {
-	if (build_context.strict_style) {
-	    	if (f->allow_newline) {
-	    		return f->expr_level > 0;
-	    	}
-	    	return f->expr_level >= 0;
+	if (f->allow_newline) {
+		return f->expr_level > 0;
 	}
 	}
-	return false;
+	return f->expr_level >= 0;
 }
 }
 
 
 
 
@@ -1556,7 +1553,7 @@ bool is_semicolon_optional_for_node(AstFile *f, Ast *s) {
 }
 }
 
 
 void expect_semicolon_newline_error(AstFile *f, Token const &token, Ast *s) {
 void expect_semicolon_newline_error(AstFile *f, Token const &token, Ast *s) {
-	if (build_context.strict_style && token.string == "\n") {
+	if (token.string == "\n") {
 		switch (token.kind) {
 		switch (token.kind) {
 		case Token_CloseBrace:
 		case Token_CloseBrace:
 		case Token_CloseParen:
 		case Token_CloseParen:
@@ -4556,9 +4553,7 @@ ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) {
 		return ParseFile_WrongExtension;
 		return ParseFile_WrongExtension;
 	}
 	}
 	TokenizerFlags tokenizer_flags = TokenizerFlag_None;
 	TokenizerFlags tokenizer_flags = TokenizerFlag_None;
-	if (build_context.insert_semicolon) {
-		tokenizer_flags = TokenizerFlag_InsertSemicolon;
-	}
+	tokenizer_flags = TokenizerFlag_InsertSemicolon;
 
 
 	zero_item(&f->tokenizer);
 	zero_item(&f->tokenizer);
 	f->tokenizer.curr_file_id = f->id;
 	f->tokenizer.curr_file_id = f->id;