--- name: Ruby fileTypes: - rb - rbx - rjs - Rakefile - rake - cgi - fcgi - gemspec firstLineMatch: ^#!/.*\bruby\b scopeName: source.ruby repository: nest_brackets: captures: "0": name: punctuation.section.scope.ruby begin: \[ end: \] patterns: - include: "#nest_brackets" interpolated_ruby: patterns: - name: source.ruby.embedded.source captures: "0": name: punctuation.section.embedded.ruby "1": name: source.ruby.embedded.source.empty match: "#\\{(\\})" - name: source.ruby.embedded.source captures: "0": name: punctuation.section.embedded.ruby begin: "#\\{" end: \} patterns: - include: "#nest_curly_and_self" - include: $self - name: variable.other.readwrite.instance.ruby captures: "1": name: punctuation.definition.variable.ruby match: (#@)[a-zA-Z_]\w* - name: variable.other.readwrite.class.ruby captures: "1": name: punctuation.definition.variable.ruby match: (#@@)[a-zA-Z_]\w* - name: variable.other.readwrite.global.ruby captures: "1": name: punctuation.definition.variable.ruby match: (#\$)[a-zA-Z_]\w* escaped_char: name: constant.character.escape.ruby match: \\(?:0\d{1,2}|x[\da-fA-F]{1,2}|.) regex_sub: patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.regexp.arbitrary-repitition.ruby captures: "1": name: punctuation.definition.arbitrary-repitition.ruby "3": name: punctuation.definition.arbitrary-repitition.ruby match: (\{)\d+(,\d+)?(\}) - name: string.regexp.character-class.ruby captures: "0": name: punctuation.definition.character-class.ruby begin: \[(?:\^?\])? end: \] patterns: - include: "#escaped_char" - name: string.regexp.group.ruby captures: "0": name: punctuation.definition.group.ruby begin: \( end: \) patterns: - include: "#regex_sub" - name: comment.line.number-sign.ruby captures: "1": name: punctuation.definition.comment.ruby match: (?<=^|\s)(#)\s[[a-zA-Z0-9,. \t?!-][^\x00-\x7F]]*$ comment: We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags. heredoc: begin: ^<<-?\w+ end: $ patterns: - include: $base nest_parens_r: captures: "0": name: punctuation.section.scope.ruby begin: \( end: \) patterns: - include: "#regex_sub" - include: "#nest_parens_r" nest_curly_r: captures: "0": name: punctuation.section.scope.ruby begin: \{ end: \} patterns: - include: "#regex_sub" - include: "#nest_curly_r" nest_parens_i: captures: "0": name: punctuation.section.scope.ruby begin: \( end: \) patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_parens_i" nest_ltgt_r: captures: "0": name: punctuation.section.scope.ruby begin: \< end: \> patterns: - include: "#regex_sub" - include: "#nest_ltgt_r" nest_curly_i: captures: "0": name: punctuation.section.scope.ruby begin: \{ end: \} patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_curly_i" nest_ltgt_i: captures: "0": name: punctuation.section.scope.ruby begin: \< end: \> patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_ltgt_i" nest_ltgt: captures: "0": name: punctuation.section.scope.ruby begin: \< end: \> patterns: - include: "#nest_ltgt" nest_curly_and_self: patterns: - captures: "0": name: punctuation.section.scope.ruby begin: \{ end: \} patterns: - include: "#nest_curly_and_self" - include: $self nest_parens: captures: "0": name: punctuation.section.scope.ruby begin: \( end: \) patterns: - include: "#nest_parens" nest_brackets_r: captures: "0": name: punctuation.section.scope.ruby begin: \[ end: \] patterns: - include: "#regex_sub" - include: "#nest_brackets_r" nest_curly: captures: "0": name: punctuation.section.scope.ruby begin: \{ end: \} patterns: - include: "#nest_curly" nest_brackets_i: captures: "0": name: punctuation.section.scope.ruby begin: \[ end: \] patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_brackets_i" uuid: E00B62AC-6B1C-11D9-9B1F-000D93589AF6 foldingStartMarker: "(?x)^\n\ \t (\\s*+\n\ \t (module|class|def\n\ \t |unless|if\n\ \t |case\n\ \t |begin\n\ \t |for|while|until\n\ \t\t\t |^=begin\n\ \t |( \"(\\\\.|[^\"])*+\" # eat a double quoted string\n\ \t | '(\\\\.|[^'])*+' # eat a single quoted string\n\ \t | [^#\"'] # eat all but comments and strings\n\ \t )*\n\ \t ( \\s (do|begin|case)\n\ \t | (?~] \\s*+ (if|unless)\n\ \t )\n\ \t )\\b\n\ \t (?! [^;]*+ ; .*? \\bend\\b )\n\ \t |( \"(\\\\.|[^\"])*+\" # eat a double quoted string\n\ \t | '(\\\\.|[^'])*+' # eat a single quoted string\n\ \t | [^#\"'] # eat all but comments and strings\n\ \t )*\n\ \t ( \\{ (?! [^}]*+ \\} )\n\ \t | \\[ (?! [^\\]]*+ \\] )\n\ \t )\n\ \t ).*$\n\ \t| [#] .*? \\(fold\\) \\s*+ $ # Sune\xE2\x80\x99s special marker\n\ \t" patterns: - name: meta.class.ruby captures: "6": name: variable.other.object.ruby "7": name: punctuation.definition.variable.ruby "1": name: keyword.control.class.ruby "2": name: entity.name.type.class.ruby "4": name: entity.other.inherited-class.ruby "5": name: punctuation.separator.inheritance.ruby match: ^\s*(class)\s+(([.a-zA-Z0-9_:]+(\s*(<)\s*[.a-zA-Z0-9_:]+)?)|((<<)\s*[.a-zA-Z0-9_:]+)) - name: meta.module.ruby captures: "6": name: punctuation.separator.inheritance.ruby "7": name: entity.other.inherited-class.module.third.ruby "8": name: punctuation.separator.inheritance.ruby "1": name: keyword.control.module.ruby "2": name: entity.name.type.module.ruby "3": name: entity.other.inherited-class.module.first.ruby "4": name: punctuation.separator.inheritance.ruby "5": name: entity.other.inherited-class.module.second.ruby match: ^\s*(module)\s+(([A-Z]\w*(::))?([A-Z]\w*(::))?([A-Z]\w*(::))*[A-Z]\w*) - name: invalid.deprecated.ruby match: (?|_|\*|\$|\?|:|"|-[0adFiIlpv]) - name: support.class.ruby match: \b[A-Z][a-z]\w*(?=((\.|::)[A-Za-z]|\[)) - name: meta.environment-variable.ruby begin: \b(ENV)\[ beginCaptures: "1": name: variable.other.constant.ruby end: \] patterns: - include: $self - name: variable.other.constant.ruby match: \b[A-Z]\w*\b - name: meta.function.method.with-arguments.ruby endCaptures: "0": name: punctuation.definition.parameters.ruby begin: (?<=^|\s)\b(def)\b\s+((?>[a-zA-Z_]\w*(?>\.|::))?(?>[a-zA-Z_]\w*(?>[?!]|=(?!>))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?))\s*(\() contentName: variable.parameter.function.ruby beginCaptures: "1": name: keyword.control.def.ruby "2": name: entity.name.function.ruby "3": name: punctuation.definition.parameters.ruby end: \) patterns: - include: $base comment: " the method pattern comes from the symbol pattern, see there for a explaination" - name: meta.function.method.without-arguments.ruby captures: "1": name: keyword.control.def.ruby "3": name: entity.name.function.ruby match: (?<=^|\s)(def)\b(\s+((?>[a-zA-Z_]\w*(?>\.|::))?(?>[a-zA-Z_]\w*(?>[?!]|=(?!>))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?)))? comment: " the optional name is just to catch the def also without a method-name" - name: constant.numeric.ruby match: \b(0[xX]\h(?>_?\h)*|\d(?>_?\d)*(\.(?![^[:space:][:digit:]])(?>_?\d)*)?([eE][-+]?\d(?>_?\d)*)?|0[bB][01]+)\b - name: constant.other.symbol.single-quoted.ruby captures: "0": name: punctuation.definition.constant.ruby begin: ":'" end: "'" patterns: - name: constant.character.escape.ruby match: \\['\\] - name: constant.other.symbol.double-quoted.ruby captures: "0": name: punctuation.definition.constant.ruby begin: ":\"" end: "\"" patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.quoted.single.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "'" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: "'" patterns: - name: constant.character.escape.ruby match: \\'|\\\\ comment: single quoted string (does not allow interpolation) - name: string.quoted.double.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "\"" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: "\"" patterns: - include: "#interpolated_ruby" - include: "#escaped_char" comment: double quoted string (allows for interpolation) - name: string.interpolated.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "`" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: "`" patterns: - include: "#interpolated_ruby" - include: "#escaped_char" comment: execute string (allows for interpolation) - name: string.interpolated.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%x\\{" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \} patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_curly_i" comment: execute string (allow for interpolation) - name: string.interpolated.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%x\\[" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \] patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_brackets_i" comment: execute string (allow for interpolation) - name: string.interpolated.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%x\\<" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \> patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_ltgt_i" comment: execute string (allow for interpolation) - name: string.interpolated.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%x\\(" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \) patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_parens_i" comment: execute string (allow for interpolation) - name: string.interpolated.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%x([^\\w])" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \1 patterns: - include: "#interpolated_ruby" - include: "#escaped_char" comment: execute string (allow for interpolation) - captures: "1": name: string.regexp.classic.ruby "2": name: punctuation.definition.string.ruby begin: "(?x)\n\ \t\t\t (?:\n\ \t\t\t ^ # beginning of line\n\ \t\t\t | (?<= # or look-behind on:\n\ \t\t\t [=>~(?:\\[,|&]\n\ \t\t\t | (?:\\s|;)when\\s\n\ \t\t\t | (?:\\s|;)or\\s\n\ \t\t\t | (?:\\s|;)and\\s\n\ \t\t\t | (?:\\s|;|\\.)index\\s\n\ \t\t\t | (?:\\s|;|\\.)scan\\s\n\ \t\t\t | (?:\\s|;|\\.)sub\\s\n\ \t\t\t | (?:\\s|l|\\.)sub!\\s\n\ \t\t\t | (?:\\s|;|\\.)gsub\\s\n\ \t\t\t | (?:\\s|;|\\.)gsub!\\s\n\ \t\t\t | (?:\\s|;|\\.)match\\s\n\ \t\t\t | (?:\\s|;)if\\s\n\ \t\t\t | (?:\\s|;)elsif\\s\n\ \t\t\t | (?:\\s|;)while\\s\n\ \t\t\t | (?:\\s|;)unless\\s\n\ \t\t\t )\n\ \t\t\t | (?<= # or a look-behind with line anchor:\n\ \t\t\t ^when\\s # duplication necessary due to limits of regex\n\ \t\t\t | ^index\\s\n\ \t\t\t | ^scan\\s\n\ \t\t\t | ^sub\\s\n\ \t\t\t | ^gsub\\s\n\ \t\t\t | ^sub!\\s\n\ \t\t\t | ^gsub!\\s\n\ \t\t\t | ^match\\s\n\ \t\t\t | ^if\\s\n\ \t\t\t | ^elsif\\s\n\ \t\t\t | ^while\\s\n\ \t\t\t | ^unless\\s\n\ \t\t\t )\n\ \t\t\t )\n\ \t\t\t \\s*((/))(?![*+{}?])\n\ \t\t\t" contentName: string.regexp.classic.ruby end: ((/[eimnosux]*)) patterns: - include: "#regex_sub" comment: "regular expressions (normal)\n\ \t\t\twe only start a regexp if the character before it (excluding whitespace)\n\ \t\t\tis what we think is before a regexp\n\ \t\t\t" - name: string.regexp.mod-r.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%r\\{" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \}[eimnosux]* patterns: - include: "#regex_sub" - include: "#nest_curly_r" comment: regular expressions (literal) - name: string.regexp.mod-r.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%r\\[" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \][eimnosux]* patterns: - include: "#regex_sub" - include: "#nest_brackets_r" comment: regular expressions (literal) - name: string.regexp.mod-r.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%r\\(" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \)[eimnosux]* patterns: - include: "#regex_sub" - include: "#nest_parens_r" comment: regular expressions (literal) - name: string.regexp.mod-r.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%r\\<" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \>[eimnosux]* patterns: - include: "#regex_sub" - include: "#nest_ltgt_r" comment: regular expressions (literal) - name: string.regexp.mod-r.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%r([^\\w])" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \1[eimnosux]* patterns: - include: "#regex_sub" comment: regular expressions (literal) - name: string.quoted.other.literal.upper.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[QWSR]?\\(" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \) patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_parens_i" comment: literal capable of interpolation () - name: string.quoted.other.literal.upper.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[QWSR]?\\[" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \] patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_brackets_i" comment: literal capable of interpolation [] - name: string.quoted.other.literal.upper.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[QWSR]?\\<" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \> patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_ltgt_i" comment: literal capable of interpolation <> - name: string.quoted.double.ruby.mod endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[QWSR]?\\{" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \} patterns: - include: "#interpolated_ruby" - include: "#escaped_char" - include: "#nest_curly_i" comment: literal capable of interpolation -- {} - name: string.quoted.other.literal.upper.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[QWSR]([^\\w])" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \1 patterns: - include: "#interpolated_ruby" - include: "#escaped_char" comment: literal capable of interpolation -- wildcard - name: string.quoted.other.literal.other.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%([^\\w\\s=])" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \1 patterns: - include: "#interpolated_ruby" - include: "#escaped_char" comment: literal capable of interpolation -- wildcard - name: string.quoted.other.literal.lower.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[qws]\\(" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \) patterns: - name: constant.character.escape.ruby match: \\\)|\\\\ - include: "#nest_parens" comment: literal incapable of interpolation -- () - name: string.quoted.other.literal.lower.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[qws]\\<" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \> patterns: - name: constant.character.escape.ruby match: \\\>|\\\\ - include: "#nest_ltgt" comment: literal incapable of interpolation -- <> - name: string.quoted.other.literal.lower.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[qws]\\[" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \] patterns: - name: constant.character.escape.ruby match: \\\]|\\\\ - include: "#nest_brackets" comment: literal incapable of interpolation -- [] - name: string.quoted.other.literal.lower.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[qws]\\{" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \} patterns: - name: constant.character.escape.ruby match: \\\}|\\\\ - include: "#nest_curly" comment: literal incapable of interpolation -- {} - name: string.quoted.other.literal.lower.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: "%[qws]([^\\w])" beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \1 patterns: - match: \\. comment: Cant be named because its not neccesarily an escape. comment: literal incapable of interpolation -- wildcard - name: constant.other.symbol.ruby captures: "1": name: punctuation.definition.constant.ruby match: (?[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|@@?[a-zA-Z_]\w*) comment: symbols - name: comment.block.documentation.ruby captures: "0": name: punctuation.definition.comment.ruby begin: ^=begin end: ^=end comment: multiline comments - name: comment.line.number-sign.ruby captures: "1": name: punctuation.definition.comment.ruby match: (?:^[ \t]+)?(#).*$\n? - name: constant.numeric.ruby match: (?\=\s*<<(\w+))(?!\s+#\s*([Cc]|sh|[Jj]ava)) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: ^\1$ patterns: - include: "#heredoc" - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.unquoted.embedded.html.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?><<-HTML\b) contentName: text.html.embedded.ruby beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \s*HTML$ patterns: - include: "#heredoc" - include: text.html.basic - include: "#interpolated_ruby" - include: "#escaped_char" comment: heredoc with embedded HTML and indented terminator - name: string.unquoted.embedded.ruby.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?><<-(["\\']?)(\w+_(?i:eval))\1) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \s*\2$ patterns: - include: "#heredoc" - include: "#interpolated_ruby" - include: source.ruby - include: "#escaped_char" comment: ruby code in heredoc, interpolated - name: string.unquoted.heredoc.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?><<-(\w+)) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: \s*\1$ patterns: - include: "#heredoc" - include: "#interpolated_ruby" - include: "#escaped_char" comment: heredoc with indented terminator - name: string.unquoted.embedded.c.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?>\=\s*<<(\w+))(?=\s+#\s*[Cc](?!(\+\+|[Ss][Ss]))) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: ^\1$ patterns: - include: "#heredoc" - include: source.c - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.unquoted.embedded.cplusplus.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?>\=\s*<<(\w+))(?=\s+#\s*[Cc]\+\+) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: ^\1$ patterns: - include: "#heredoc" - include: source.c++ - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.unquoted.embedded.css.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?>\=\s*<<(\w+))(?=\s+#\s*[Cc][Ss][Ss]) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: ^\1$ patterns: - include: "#heredoc" - include: source.css - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.unquoted.embedded.js.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?>\=\s*<<(\w+))(?=\s+#\s*[Jj]ava[Ss]cript) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: ^\1$ patterns: - include: "#heredoc" - include: source.js - include: "#interpolated_ruby" - include: "#escaped_char" - name: string.unquoted.embedded.shell.ruby endCaptures: "0": name: punctuation.definition.string.end.ruby begin: (?>\=\s*<<(\w+))(?=\s+#\s*sh) beginCaptures: "0": name: punctuation.definition.string.begin.ruby end: ^\1$ patterns: - include: "#heredoc" - include: source.shell - include: "#interpolated_ruby" - include: "#escaped_char" - name: meta.function-call.method.with-arguments.ruby begin: (?<=[^\.])(?=(\.|::)[a-zA-Z][a-zA-Z0-9_!?=]*\()(\.|::) beginCaptures: "1": name: punctuation.separator.method.ruby end: (?<=[a-zA-Z0-9_!?=])(?=\() patterns: - comment: "made this way to eventually support including #known_function_names" - name: entity.name.function.ruby match: ([a-zA-Z][a-zA-Z0-9_!?=]*)(?=[^a-zA-Z0-9_!?]) - name: meta.function-call.method.without-arguments.ruby begin: (?<=[^\.])(?=(\.|::)[a-zA-Z][a-zA-Z0-9_!?]*[^a-zA-Z0-9_!?])(\.|::) beginCaptures: "1": name: punctuation.separator.method.ruby end: (?<=[a-zA-Z0-9_!?])(?=[^a-zA-Z0-9_!?]) patterns: - comment: "made this way to eventually support including #known_function_names" - name: entity.name.function.ruby match: ([a-zA-Z][a-zA-Z0-9_!?]*)(?=[^a-zA-Z0-9_!?]) - name: meta.function-call.ruby begin: (?=[a-zA-Z][a-zA-Z0-9_!?]+\() end: (?=\() patterns: - comment: "eventually include #known_function_names" - name: entity.name.function.ruby match: ([a-zA-Z0-9_!?]+)(?=\() - captures: "1": name: punctuation.separator.variable.ruby begin: (?<=\{|do|\{\s|do\s)(\|) end: (\|) patterns: - name: variable.other.block.ruby match: "[_a-zA-Z][_a-zA-Z0-9]*" - name: punctuation.separator.variable.ruby match: "," - name: punctuation.separator.key-value match: => - name: keyword.operator.unary.ruby match: \+@|-@ - name: keyword.operator.assignment.augmented.ruby match: <<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|/=|<< - name: keyword.operator.comparison.ruby match: <=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\? - name: keyword.operator.logical.ruby match: (?<=[ \t])!|\bnot\b|&&|\band\b|\|\||\bor\b|\^ - name: keyword.operator.arithmetic.ruby match: (%|&|\*\*|\*|\+|\-|/) - name: keyword.operator.assignment.ruby match: "=" - name: keyword.operator.other.ruby match: \||~|>> - name: punctuation.separator.other.ruby match: ":" - name: punctuation.separator.statement.ruby match: \; - name: punctuation.separator.object.ruby match: "," - name: punctuation.separator.method.ruby match: "\\.|::" - name: punctuation.section.scope.ruby match: \{|\} - name: punctuation.section.array.ruby match: \[|\] - name: punctuation.section.function.ruby match: \(|\) foldingStopMarker: "(?x)\n\ \t\t( (^|;) \\s*+ end \\s*+ ([#].*)? $\n\ \t\t| (^|;) \\s*+ end \\. .* $\n\ \t\t| ^ \\s*+ [}\\]] \\s*+ ([#].*)? $\n\ \t\t| [#] .*? \\(end\\) \\s*+ $ # Sune\xE2\x80\x99s special marker\n\ \t\t| ^=end\n\ \t\t)" keyEquivalent: ^~R comment: "\n\ \tTODO: unresolved issues\n\n\ \ttext:\n\ \t\"p << end\n\ \tprint me!\n\ \tend\"\n\ \tsymptoms:\n\ \tnot recognized as a heredoc\n\ \tsolution:\n\ \tthere is no way to distinguish perfectly between the << operator and the start\n\ \tof a heredoc. Currently, we require assignment to recognize a heredoc. More\n\ \trefinement is possible.\n\ \t\xE2\x80\xA2 Heredocs with indented terminators (<<-) are always distinguishable, however.\n\ \t\xE2\x80\xA2 Nested heredocs are not really supportable at present\n\n\ \ttext:\n\ \tprint <<-'THERE' \n\ \tThis is single quoted. \n\ \tThe above used #{Time.now} \n\ \tTHERE \n\ \tsymtoms:\n\ \tFrom Programming Ruby p306; should be a non-interpolated heredoc.\n\ \t\n\ \ttext:\n\ \t\"a\\332a\"\n\ \tsymptoms:\n\ \t'\\332' is not recognized as slash3.. which should be octal 332.\n\ \tsolution:\n\ \tplain regexp.. should be easy.\n\n text:\n val?(a):p(b)\n val?'a':'b'\n symptoms:\n ':p' is recognized as a symbol.. its 2 things ':' and 'p'.\n :'b' has same problem.\n solution:\n ternary operator rule, precedence stuff, symbol rule.\n but also consider 'a.b?(:c)' ??\n"