From 08368b178c2d180835ea53ecac867f1c8fdf9c8c Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sun, 7 Jul 2019 09:52:01 +0200 Subject: [PATCH] Update clang-format config, run it. --- .clang-format | 2 ++ .gitignore | 1 - examples/turtle/turtle.cpp | 28 ++++++++-------------------- src/ast.def | 2 +- src/codegen.def | 2 +- src/lexer.def | 2 +- src/operators.def | 2 +- src/types.def | 2 +- 8 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 .gitignore diff --git a/.clang-format b/.clang-format index d47f207..8d716df 100644 --- a/.clang-format +++ b/.clang-format @@ -4,8 +4,10 @@ IndentWidth: 2 --- Language: Cpp PointerAlignment: Left +AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: true ColumnLimit: 100 AlignEscapedNewlines: DontAlign BreakStringLiterals: false SpaceAfterTemplateKeyword: false +SortIncludes: true diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/examples/turtle/turtle.cpp b/examples/turtle/turtle.cpp index 1dbd454..c30c5be 100644 --- a/examples/turtle/turtle.cpp +++ b/examples/turtle/turtle.cpp @@ -25,21 +25,13 @@ public: moveTo(0, 0); } - void setColor(double r, double g, double b) { - cairo_set_source_rgb(context, r, g, b); - } + void setColor(double r, double g, double b) { cairo_set_source_rgb(context, r, g, b); } - void setLineWidth(double size) { - cairo_set_line_width(context, size); - } + void setLineWidth(double size) { cairo_set_line_width(context, size); } - void paint() { - cairo_paint(context); - } + void paint() { cairo_paint(context); } - void moveTo(double x, double y) { - cairo_move_to(context, x, y); - } + void moveTo(double x, double y) { cairo_move_to(context, x, y); } void rectangleTo(double width, double height) { double baseX; @@ -58,17 +50,13 @@ public: moveTo(x, y); } - void save(char const* filename) { - cairo_surface_write_to_png(surface, filename); - } + void save(char const* filename) { cairo_surface_write_to_png(surface, filename); } - void save(std::string const& filename) { - save(filename.c_str()); - } + void save(std::string const& filename) { save(filename.c_str()); } private: - cairo_surface_t *surface; - cairo_t *context; + cairo_surface_t* surface; + cairo_t* context; }; static std::unique_ptr turtle; diff --git a/src/ast.def b/src/ast.def index 76a46dd..cf3bba7 100644 --- a/src/ast.def +++ b/src/ast.def @@ -22,6 +22,6 @@ V(Module) \ V(FunctionCallExpression) \ V(BinaryExpression) \ - V(AtomicExpression) \ + V(AtomicExpression) #endif diff --git a/src/codegen.def b/src/codegen.def index eba553c..876bce5 100644 --- a/src/codegen.def +++ b/src/codegen.def @@ -32,6 +32,6 @@ V(GE, OGE) \ V(GT, OGT) \ V(LE, OLE) \ - V(LT, OLT) \ + V(LT, OLT) #endif diff --git a/src/lexer.def b/src/lexer.def index 3b519c6..a14aa5c 100644 --- a/src/lexer.def +++ b/src/lexer.def @@ -38,6 +38,6 @@ V(FUN_PARAMS, VOID) \ V(RETURN, VOID) \ V(END, VOID) \ - V(UNKNOWN, VOID) \ + V(UNKNOWN, VOID) #endif diff --git a/src/operators.def b/src/operators.def index e7f41d4..258e84e 100644 --- a/src/operators.def +++ b/src/operators.def @@ -19,7 +19,7 @@ V(OP_PLUS, VOID) \ V(OP_MINUS, VOID) \ V(OP_TIMES, VOID) \ - V(OP_DIV, VOID) \ + V(OP_DIV, VOID) // lexer_token, ast_operator, priority, representation // All priorities must be STRICTLY LARGER than 0. diff --git a/src/types.def b/src/types.def index 2756610..62a81dc 100644 --- a/src/types.def +++ b/src/types.def @@ -11,6 +11,6 @@ V(CHAR, Int8, "%c", "%c", "Mascetti", "char") \ V(FLOAT, Float, "%f", "%f\n", "Perozzi", "float") \ V(BOOL, Int1, "%d", "%d\n", "Melandri", "bool") \ - V(DOUBLE, Double, "%lf", "%f\n", "Sassaroli", "double") \ + V(DOUBLE, Double, "%lf", "%f\n", "Sassaroli", "double") #endif