| 45 | } |
| 46 | |
| 47 | void LuaStyle::Parse(std::map<std::string, std::string, std::less<>> &configMap) { |
| 48 | IF_EXIST(indent_style) { |
| 49 | if (value == "tab") { |
| 50 | indent_style = IndentStyle::Tab; |
| 51 | } else if (value == "space") { |
| 52 | indent_style = IndentStyle::Space; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | NUMBER_OPTION(indent_size) |
| 57 | |
| 58 | NUMBER_OPTION(tab_width) |
| 59 | |
| 60 | IF_EXIST(quote_style) { |
| 61 | if (value == "single") { |
| 62 | quote_style = QuoteStyle::Single; |
| 63 | } else if (value == "double") { |
| 64 | quote_style = QuoteStyle::Double; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // for editorconfig Domain-Specific Properties |
| 69 | IF_EXIST(qoute_type) { |
| 70 | if (value == "single") { |
| 71 | quote_style = QuoteStyle::Single; |
| 72 | } else if (value == "double") { |
| 73 | quote_style = QuoteStyle::Double; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | IF_EXIST(table_separator_style) { |
| 78 | if (value == "none") { |
| 79 | table_separator_style = TableSeparatorStyle::None; |
| 80 | } else if (value == "comma") { |
| 81 | table_separator_style = TableSeparatorStyle::Comma; |
| 82 | } else if (value == "semicolon") { |
| 83 | table_separator_style = TableSeparatorStyle::Semicolon; |
| 84 | } else if (value == "only_kv_colon") { |
| 85 | table_separator_style = TableSeparatorStyle::OnlyKVColon; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | IF_EXIST(max_line_length) { |
| 90 | if (IsNumber(value)) { |
| 91 | max_line_length = std::stoi(value); |
| 92 | } else if (value == "unset") { |
| 93 | max_line_length = 998; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | IF_EXIST(end_of_line) { |
| 98 | if (value == "crlf") { |
| 99 | end_of_line = EndOfLine::CRLF; |
| 100 | } else if (value == "lf") { |
| 101 | end_of_line = EndOfLine::LF; |
| 102 | } else if (value == "cr") { |
| 103 | end_of_line = EndOfLine::CR; |
| 104 | } else if (value == "auto" || value == "unset") { |
no test coverage detected