{
  "name": "gnuplot",
  "scopeName": "source.gnuplot",
  "uuid": "A75AB1C2-611C-4500-9EE4-20668B5BB465",
  "fileTypes": ["gp", "plt", "plot", "gnuplot"],
  "patterns": [
    {
      "name": "invalid.illegal.backslash.gnuplot",
      "match": "(\\\\(?!\\n).*)"
    },
    {
      "name": "punctuation.separator.statement.gnuplot",
      "match": "(;)"
    },
    {
      "include": "#LineComment"
    },
    {
      "include": "#DataBlock"
    },
    {
      "include": "#MacroExpansion"
    },
    {
      "include": "#VariableDecl"
    },
    {
      "include": "#ArrayDecl"
    },
    {
      "include": "#FunctionDecl"
    },
    {
      "include": "#ShellCommand"
    },
    {
      "include": "#Command"
    }
  ],
  "repository": {
    "DataBlock": {
      "name": "meta.datablock.gnuplot",
      "begin": "(?x:\n\t\t\t\t([$][A-Za-z_]\\w*)\\s*             # 1: var name\n\t\t\t\t(<<)\\s*                    # 2: shift operator\n\t\t\t\t([A-Za-z_]\\w*)\\s*                # 3: end tag\n\t\t\t\t(?=(\\#|$))                       # 4: comment or end of line\n\t\t\t)",
      "beginCaptures": {
        "1": {
          "patterns": [
            {
              "include": "#SpecialVariable"
            }
          ]
        },
        "3": {
          "name": "constant.language.datablock.gnuplot"
        }
      },
      "end": "^(\\3)\\b(.*)",
      "endCaptures": {
        "1": {
          "name": "constant.language.datablock.gnuplot"
        },
        "2": {
          "name": "invalid.illegal.datablock.gnuplot"
        }
      },
      "patterns": [
        {
          "include": "#LineComment"
        },
        {
          "include": "#NumberLiteral"
        },
        {
          "include": "#DoubleQuotedStringLiteral"
        }
      ]
    },
    "MacroExpansion": {
      "begin": "([@][A-Za-z_]\\w*)",
      "beginCaptures": {
        "1": {
          "patterns": [
            {
              "include": "#SpecialVariable"
            }
          ]
        }
      },
      "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
      "patterns": [
        {
          "include": "#Expression"
        }
      ]
    },
    "VariableDecl": {
      "name": "meta.variable.gnuplot",
      "begin": "\\b(?x:\n\t\t\t\t([A-Za-z_]\\w*)\\s*                # 1: var name\n\t\t\t\t(?:\n\t\t\t\t\t(\\[)\\s*                      # 2: opening bracket\n\t\t\t\t\t(.*)\\s*                      # 3: expression\n\t\t\t\t\t(\\])\\s*                      # 4: closing bracket\n\t\t\t\t)?\n\t\t\t\t(?=(=)(?!\\s*=))                  # 5: assignment\n\t\t\t)",
      "beginCaptures": {
        "1": {
          "name": "entity.name.variable.gnuplot",
          "patterns": [
            {
              "include": "#InvalidVariableDecl"
            },
            {
              "include": "#BuiltinVariable"
            }
          ]
        },
        "3": {
          "patterns": [
            {
              "include": "#Expression"
            }
          ]
        }
      },
      "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
      "patterns": [
        {
          "include": "#Expression"
        }
      ]
    },
    "ArrayDecl": {
      "name": "meta.variable.gnuplot",
      "begin": "\\b(?x:\n\t\t\t\t(array)\\s+                       # 1: array keyword\n\t\t\t\t([A-Za-z_]\\w*)?                  # 2: var name\n\t\t\t\t# Note: Handle size decl and init expression inside.\n\t\t\t\t# TODO: Properly annotate brackets.\n\t\t\t)",
      "beginCaptures": {
        "1": {
          "name": "support.type.array.gnuplot"
        },
        "2": {
          "name": "entity.name.variable.gnuplot",
          "patterns": [
            {
              "include": "#InvalidVariableDecl"
            },
            {
              "include": "#BuiltinVariable"
            }
          ]
        }
      },
      "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
      "patterns": [
        {
          "include": "#Expression"
        }
      ]
    },
    "FunctionDecl": {
      "name": "meta.function.gnuplot",
      "begin": "\\b(?x:\n\t\t\t\t([A-Za-z_]\\w*)\\s*                # 1: func name\n\t\t\t\t(                                # 2: parameter list\n\t\t\t\t\t(\\()\\s*                      # 3: opening parens\n\t\t\t\t\t([A-Za-z_]\\w*)\\s*            # 4: arg name\n\t\t\t\t\t(?:\n\t\t\t\t\t\t(,)\\s*                   # 5: comma\n\t\t\t\t\t\t([A-Za-z_]\\w*)\\s*        # 6: other args\n\t\t\t\t\t)*\n\t\t\t\t\t(\\))                         # 7: closing parens\n\t\t\t\t)\n\t\t\t)",
      "beginCaptures": {
        "1": {
          "name": "entity.name.function.gnuplot",
          "patterns": [
            {
              "include": "#BuiltinFunction"
            }
          ]
        },
        "2": {
          "name": "meta.function.parameters.gnuplot"
        },
        "3": {
          "name": "punctuation.definition.parameters.begin.gnuplot"
        },
        "4": {
          "name": "variable.parameter.function.language.gnuplot"
        },
        "5": {
          "name": "punctuation.separator.parameters.gnuplot"
        },
        "6": {
          "name": "variable.parameter.function.language.gnuplot"
        },
        "7": {
          "name": "punctuation.definition.parameters.end.gnuplot"
        }
      },
      "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
      "patterns": [
        {
          "include": "#Expression"
        }
      ]
    },
    "InvalidVariableDecl": {
      "name": "invalid.illegal.variable.gnuplot",
      "match": "\\b(GPVAL_\\w*|MOUSE_\\w*)\\b"
    },
    "ShellCommand": {
      "begin": "(!)",
      "beginCaptures": {
        "1": {
          "name": "keyword.other.shell.gnuplot"
        }
      },
      "end": "(?=(#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
      "patterns": [
        {
          "name": "string.unquoted",
          "match": "([^#]|\\\\(?=\\n))"
        }
      ]
    },
    "Command": {
      "patterns": [
        {
          "name": "invalid.deprecated.command.gnuplot",
          "begin": "\\b(?x:\n\t\t\t\t\t\tupdate\n\t\t\t\t\t)\\b",
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))"
        },
        {
          "begin": "\\b(?x:\n\t\t\t\t\t\tbreak        |\n\t\t\t\t\t\tclear        |\n\t\t\t\t\t\tcontinue     |\n\t\t\t\t\t\tpwd          |\n\t\t\t\t\t\trefresh      |\n\t\t\t\t\t\treplot       |\n\t\t\t\t\t\treread       |\n\t\t\t\t\t\tshell\n\t\t\t\t\t)\\b",
          "beginCaptures": {
            "0": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#InvalidWord"
            }
          ]
        },
        {
          "begin": "\\b(?x:\n\t\t\t\t\t\tcd           |\n\t\t\t\t\t\tcall         |\n\t\t\t\t\t\teval         |\n\t\t\t\t\t\texit         |\n\t\t\t\t\t\thelp         |\n\t\t\t\t\t\thistory      |\n\t\t\t\t\t\tload         |\n\t\t\t\t\t\tlower        |\n\t\t\t\t\t\tpause        |\n\t\t\t\t\t\tprint        |\n\t\t\t\t\t\tprinterr     |\n\t\t\t\t\t\tquit         |\n\t\t\t\t\t\traise        |\n\t\t\t\t\t\tsave         |\n\t\t\t\t\t\tstats        |\n\t\t\t\t\t\tsystem       |\n\t\t\t\t\t\ttest         |\n\t\t\t\t\t\ttoggle\n\t\t\t\t\t)\\b",
          "beginCaptures": {
            "0": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#Expression"
            }
          ]
        },
        {
          "begin": "\\b(import)\\s(.+)\\s(from)",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.import.gnuplot"
            },
            "2": {
              "patterns": [
                {
                  "include": "#FunctionDecl"
                }
              ]
            },
            "3": {
              "name": "keyword.control.import.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#SingleQuotedStringLiteral"
            },
            {
              "include": "#DoubleQuotedStringLiteral"
            },
            {
              "include": "#InvalidWord"
            }
          ]
        },
        {
          "begin": "\\b(reset)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "name": "support.class.reset.gnuplot",
              "match": "\\b(bind|error(state)?|session)\\b"
            },
            {
              "include": "#InvalidWord"
            }
          ]
        },
        {
          "begin": "\\b(undefine)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#BuiltinVariable"
            },
            {
              "include": "#BuiltinFunction"
            },
            {
              "name": "source.gnuplot",
              "match": "(?<=\\s)([$]?[A-Za-z_]\\w*\\*?)(?=\\s)"
            },
            {
              "include": "#InvalidWord"
            }
          ]
        },
        {
          "begin": "\\b(if|while)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.conditional.gnuplot"
            }
          },
          "end": "(?=(\\{|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#Expression"
            }
          ]
        },
        {
          "begin": "\\b(else)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.conditional.gnuplot"
            }
          },
          "end": "(?=(\\{|#|\\\\(?!\\n)|(?<!\\\\)\\n$))"
        },
        {
          "begin": "\\b(do)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.flow.gnuplot"
            }
          },
          "end": "(?=(\\{|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#ForIterationExpr"
            }
          ]
        },
        {
          "begin": "\\b(set)(?=\\s+pm3d)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "name": "invalid.deprecated.options.gnuplot",
              "match": "\\b(hidden3d|map|transparent|solid)\\b"
            },
            {
              "include": "#SetUnsetOptions"
            },
            {
              "include": "#ForIterationExpr"
            },
            {
              "include": "#Expression"
            }
          ]
        },
        {
          "begin": "\\b((un)?set)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#SetUnsetOptions"
            },
            {
              "include": "#ForIterationExpr"
            },
            {
              "include": "#Expression"
            }
          ]
        },
        {
          "begin": "\\b(show)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#ExtraShowOptions"
            },
            {
              "include": "#SetUnsetOptions"
            },
            {
              "include": "#Expression"
            }
          ]
        },
        {
          "begin": "\\b(fit|(s)?plot)\\b",
          "beginCaptures": {
            "1": {
              "name": "keyword.other.command.gnuplot"
            }
          },
          "end": "(?=(;|#|\\\\(?!\\n)|(?<!\\\\)\\n$))",
          "patterns": [
            {
              "include": "#ColumnIndexLiteral"
            },
            {
              "include": "#PlotModifiers"
            },
            {
              "include": "#ForIterationExpr"
            },
            {
              "include": "#Expression"
            }
          ]
        }
      ]
    },
    "SetUnsetOptions": {
      "patterns": [
        {
          "name": "invalid.deprecated.options.gnuplot",
          "match": "\\G\\s*\\b(?x:\n\t\t\t\t\t\tclabel              |\n\t\t\t\t\t\tdata                |\n\t\t\t\t\t\tfunction            |\n\t\t\t\t\t\thistorysize         |\n\t\t\t\t\t\tmacros              |\n\t\t\t\t\t\tticslevel           |\n\t\t\t\t\t\tticscale            |\n\t\t\t\t\t\t(style\\s+increment\\s+\\w+)\n\t\t\t\t\t)\\b"
        },
        {
          "name": "support.class.options.gnuplot",
          "match": "\\G\\s*\\b(?x:\n\t\t\t\t\t\tangles              |\n\t\t\t\t\t\tarrow               |\n\t\t\t\t\t\tautoscale           |\n\t\t\t\t\t\tborder              |\n\t\t\t\t\t\tboxwidth            |\n\t\t\t\t\t\tclip                |\n\t\t\t\t\t\tcntr(label|param)   |\n\t\t\t\t\t\tcolor(box|sequence)?|\n\t\t\t\t\t\tcontour             |\n\t\t\t\t\t\t(dash|line)type     |\n\t\t\t\t\t\tdatafile            |\n\t\t\t\t\t\tdecimal(sign)?      |\n\t\t\t\t\t\tdgrid3d             |\n\t\t\t\t\t\tdummy               |\n\t\t\t\t\t\tencoding            |\n\t\t\t\t\t\t(error)?bars        |\n\t\t\t\t\t\tfit                 |\n\t\t\t\t\t\tfontpath            |\n\t\t\t\t\t\tformat              |\n\t\t\t\t\t\tgrid                |\n\t\t\t\t\t\thidden3d            |\n\t\t\t\t\t\thistory             |\n\t\t\t\t\t\t(iso)?samples       |\n\t\t\t\t\t\tjitter              |\n\t\t\t\t\t\tkey                 |\n\t\t\t\t\t\tlabel               |\n\t\t\t\t\t\tlink                |\n\t\t\t\t\t\tloadpath            |\n\t\t\t\t\t\tlocale              |\n\t\t\t\t\t\tlogscale            |\n\t\t\t\t\t\tmapping             |\n\t\t\t\t\t\t[lrtb]margin        |\n\t\t\t\t\t\tmargins             |\n\t\t\t\t\t\tmicro               |\n\t\t\t\t\t\tminus(sign)?        |\n\t\t\t\t\t\tmono(chrome)?       |\n\t\t\t\t\t\tmouse               |\n\t\t\t\t\t\tmultiplot           |\n\t\t\t\t\t\tnonlinear           |\n\t\t\t\t\t\tobject              |\n\t\t\t\t\t\toffsets             |\n\t\t\t\t\t\torigin              |\n\t\t\t\t\t\toutput              |\n\t\t\t\t\t\tparametric          |\n\t\t\t\t\t\t(p|r)axis           |\n\t\t\t\t\t\tpm3d                |\n\t\t\t\t\t\tpalette             |\n\t\t\t\t\t\tpointintervalbox    |\n\t\t\t\t\t\tpointsize           |\n\t\t\t\t\t\tpolar               |\n\t\t\t\t\t\tprint               |\n\t\t\t\t\t\tpsdir               |\n\t\t\t\t\t\tsize                |\n\t\t\t\t\t\tstyle               |\n\t\t\t\t\t\tsurface             |\n\t\t\t\t\t\ttable               |\n\t\t\t\t\t\tterminal            |\n\t\t\t\t\t\ttermoption          |\n\t\t\t\t\t\ttheta               |\n\t\t\t\t\t\ttics                |\n\t\t\t\t\t\ttimestamp           |\n\t\t\t\t\t\ttimefmt             |\n\t\t\t\t\t\ttitle               |\n\t\t\t\t\t\tview                |\n\t\t\t\t\t\txyplane             |\n\t\t\t\t\t\tzero                |\n\t\t\t\t\t\t(no)?(m)?(x|x2|y|y2|z|cb|r|t)tics  |\n\t\t\t\t\t\t(x|x2|y|y2|z|cb)data               |\n\t\t\t\t\t\t(x|x2|y|y2|z|cb|r)label            |\n\t\t\t\t\t\t(x|x2|y|y2|z|cb)dtics              |\n\t\t\t\t\t\t(x|x2|y|y2|z|cb)mtics              |\n\t\t\t\t\t\t(x|x2|y|y2|z|cb|[rtuv])range       |\n\t\t\t\t\t\t(x|x2|y|y2|z)?zeroaxis\n\t\t\t\t\t)\\b"
        }
      ]
    },
    "ExtraShowOptions": {
      "name": "support.class.options.gnuplot",
      "match": "\\b(?x:\n\t\t\t\tall                         |\n\t\t\t\tbind                        |\n\t\t\t\tcolornames                  |\n\t\t\t\tfunctions                   |\n\t\t\t\tplot                        |\n\t\t\t\tvariables                   |\n\t\t\t\tversion\n\t\t\t)\\b"
    },
    "PlotModifiers": {
      "patterns": [
        {
          "name": "invalid.deprecated.plot.gnuplot",
          "match": "\\b(thru)\\b"
        },
        {
          "name": "storage.type.plot.gnuplot",
          "match": "\\b(?x:\n\t\t\t\t\t\tin(dex)?            |\n\t\t\t\t\t\tevery               |\n\t\t\t\t\t\tus(ing)?            |\n\t\t\t\t\t\twi(th)?             |\n\t\t\t\t\t\tvia\n\t\t\t\t\t)\\b"
        },
        {
          "name": "storage.type.plot.gnuplot",
          "match": "\\b(newhist(ogram)?)\\b"
        }
      ]
    },
    "InvalidWord": {
      "name": "invalid.illegal.gnuplot",
      "match": "([^;#\\\\[:space:]]+)"
    },
    "Expression": {
      "patterns": [
        {
          "include": "#Literal"
        },
        {
          "include": "#SpecialVariable"
        },
        {
          "include": "#BuiltinVariable"
        },
        {
          "include": "#BuiltinOperator"
        },
        {
          "include": "#TernaryExpr"
        },
        {
          "include": "#FunctionCallExpr"
        },
        {
          "include": "#SummationExpr"
        }
      ]
    },
    "ForIterationExpr": {
      "begin": "\\b(?x:\n\t\t\t\t(for)\\s*                    # 1: for keyword\n\t\t\t\t(\\[)\\s*                     # 2: opening bracket\n\t\t\t\t(?:                         #    optionally\n\t\t\t\t\t([A-Za-z_]\\w*)\\s+       # 3: var name\n\t\t\t\t\t(in)\\b                  # 4: in keyword\n\t\t\t\t)?\n\t\t\t)",
      "beginCaptures": {
        "1": {
          "name": "keyword.control.flow.gnuplot"
        },
        "2": {
          "patterns": [
            {
              "include": "#RangeSeparators"
            }
          ]
        },
        "3": {
          "name": "variable.other.iterator.gnuplot"
        },
        "4": {
          "name": "keyword.control.flow.gnuplot"
        }
      },
      "end": "((\\])|(?=(#|\\\\(?!\\n)|(?<!\\\\)\\n$)))",
      "endCaptures": {
        "2": {
          "patterns": [
            {
              "include": "#RangeSeparators"
            }
          ]
        }
      },
      "patterns": [
        {
          "include": "#Expression"
        },
        {
          "include": "#RangeSeparators"
        }
      ]
    },
    "SummationExpr": {
      "begin": "\\b(sum)\\s*(\\[)",
      "beginCaptures": {
        "1": {
          "name": "keyword.other.sum.gnuplot"
        },
        "2": {
          "patterns": [
            {
              "include": "#RangeSeparators"
            }
          ]
        }
      },
      "end": "((\\])|(?=(#|\\\\(?!\\n)|(?<!\\\\)\\n$)))",
      "endCaptures": {
        "2": {
          "patterns": [
            {
              "include": "#RangeSeparators"
            }
          ]
        }
      },
      "patterns": [
        {
          "include": "#Expression"
        },
        {
          "include": "#RangeSeparators"
        }
      ]
    },
    "FunctionCallExpr": {
      "name": "meta.function-call.gnuplot",
      "begin": "\\b([A-Za-z_]\\w*)\\s*(\\()",
      "beginCaptures": {
        "1": {
          "name": "variable.function.gnuplot",
          "patterns": [
            {
              "include": "#BuiltinFunction"
            }
          ]
        },
        "2": {
          "name": "punctuation.definition.arguments.begin.gnuplot"
        }
      },
      "end": "((\\))|(?=(#|\\\\(?!\\n)|(?<!\\\\)\\n$)))",
      "endCaptures": {
        "2": {
          "name": "punctuation.definition.arguments.end.gnuplot"
        }
      },
      "patterns": [
        {
          "include": "#Expression"
        }
      ]
    },
    "TernaryExpr": {
      "begin": "(?<!\\?)(\\?)(?!\\?)",
      "beginCaptures": {
        "1": {
          "name": "keyword.operator.ternary.gnuplot"
        }
      },
      "end": "((?<!:)(:)(?!:)|(?=(#|\\\\(?!\\n)|(?<!\\\\)\\n$)))",
      "endCaptures": {
        "2": {
          "name": "keyword.operator.ternary.gnuplot"
        }
      },
      "patterns": [
        {
          "include": "#Expression"
        }
      ]
    },
    "RangeSeparators": {
      "patterns": [
        {
          "name": "punctuation.section.brackets.begin.gnuplot",
          "match": "(\\[)"
        },
        {
          "name": "punctuation.separator.range.gnuplot",
          "match": "(:)"
        },
        {
          "name": "punctuation.section.brackets.end.gnuplot",
          "match": "(\\])"
        }
      ]
    },
    "BuiltinOperator": {
      "patterns": [
        {
          "name": "keyword.operator.logical.gnuplot",
          "match": "(&&|\\|\\|)"
        },
        {
          "name": "keyword.operator.bitwise.gnuplot",
          "match": "(<<|>>|&|\\||\\^)"
        },
        {
          "name": "keyword.operator.comparison.gnuplot",
          "match": "(==|!=|<=|<|>=|>)"
        },
        {
          "name": "keyword.operator.assignment.gnuplot",
          "match": "(=)"
        },
        {
          "name": "keyword.operator.arithmetic.gnuplot",
          "match": "(\\+|-|~|!)"
        },
        {
          "name": "keyword.operator.arithmetic.gnuplot",
          "match": "(\\*\\*|\\+|-|\\*|/|%)"
        },
        {
          "name": "keyword.operator.strings.gnuplot",
          "match": "(\\.|\\b(eq|ne)\\b)",
          "captures": {
            "2": {
              "name": "keyword.operator.word.gnuplot"
            }
          }
        }
      ]
    },
    "BuiltinVariable": {
      "patterns": [
        {
          "name": "invalid.deprecated.variable.gnuplot",
          "match": "\\b(?x:\n\t\t\t\t\t\tFIT_LIMIT           |\n\t\t\t\t\t\tFIT_MAXITER         |\n\t\t\t\t\t\tFIT_START_LAMBDA    |\n\t\t\t\t\t\tFIT_LAMBDA_FACTOR   |\n\t\t\t\t\t\tFIT_SKIP            |\n\t\t\t\t\t\tFIT_INDEX\n\t\t\t\t\t)\\b"
        },
        {
          "name": "support.constant.gnuplot",
          "match": "\\b(GPVAL_\\w*|MOUSE_\\w*)\\b"
        },
        {
          "name": "support.variable.gnuplot",
          "match": "\\b(ARG[0-9C]|GPFUN_\\w*|FIT_\\w*|STATS_\\w*|pi|NaN)\\b"
        }
      ]
    },
    "SpecialVariable": {
      "patterns": [
        {
          "match": "(?<=[\\[:=])\\s*(\\*)\\s*(?=[:\\]])",
          "captures": {
            "1": {
              "name": "constant.language.wildcard.gnuplot"
            }
          }
        },
        {
          "name": "constant.language.special.gnuplot",
          "match": "(([@$])[A-Za-z_]\\w*)\\b",
          "captures": {
            "2": {
              "name": "punctuation.definition.variable.gnuplot"
            }
          }
        }
      ]
    },
    "BuiltinFunction": {
      "patterns": [
        {
          "name": "invalid.deprecated.function.gnuplot",
          "match": "\\b(?x:\n\t\t\t\t\t\tdefined\n\t\t\t\t\t)\\b"
        },
        {
          "name": "support.function.math.gnuplot",
          "match": "\\b(?x:\n\t\t\t\t\t\tabs            |\n\t\t\t\t\t\tacos           |\n\t\t\t\t\t\tacosh          |\n\t\t\t\t\t\tairy           |\n\t\t\t\t\t\targ            |\n\t\t\t\t\t\tasin           |\n\t\t\t\t\t\tasinh          |\n\t\t\t\t\t\tatan           |\n\t\t\t\t\t\tatan2          |\n\t\t\t\t\t\tatanh          |\n\t\t\t\t\t\tEllipticK      |\n\t\t\t\t\t\tEllipticE      |\n\t\t\t\t\t\tEllipticPi     |\n\t\t\t\t\t\tbesj0          |\n\t\t\t\t\t\tbesj1          |\n\t\t\t\t\t\tbesy0          |\n\t\t\t\t\t\tbesy1          |\n\t\t\t\t\t\tceil           |\n\t\t\t\t\t\tcos            |\n\t\t\t\t\t\tcosh           |\n\t\t\t\t\t\terf            |\n\t\t\t\t\t\terfc           |\n\t\t\t\t\t\texp            |\n\t\t\t\t\t\texpint         |\n\t\t\t\t\t\tfloor          |\n\t\t\t\t\t\tgamma          |\n\t\t\t\t\t\tibeta          |\n\t\t\t\t\t\tinverf         |\n\t\t\t\t\t\tigamma         |\n\t\t\t\t\t\timag           |\n\t\t\t\t\t\tinvnorm        |\n\t\t\t\t\t\tint            |\n\t\t\t\t\t\tlambertw       |\n\t\t\t\t\t\tlgamma         |\n\t\t\t\t\t\tlog            |\n\t\t\t\t\t\tlog10          |\n\t\t\t\t\t\tnorm           |\n\t\t\t\t\t\trand           |\n\t\t\t\t\t\treal           |\n\t\t\t\t\t\tsgn            |\n\t\t\t\t\t\tsin            |\n\t\t\t\t\t\tsinh           |\n\t\t\t\t\t\tsqrt           |\n\t\t\t\t\t\ttan            |\n\t\t\t\t\t\ttanh           |\n\t\t\t\t\t\tvoigt          |\n\t\t\t\t\t\tcerf           |\n\t\t\t\t\t\tcdawson        |\n\t\t\t\t\t\tfaddeeva       |\n\t\t\t\t\t\terfi           |\n\t\t\t\t\t\tVP\n\t\t\t\t\t)\\b"
        },
        {
          "name": "support.function.string.gnuplot",
          "match": "\\b(?x:\n\t\t\t\t\t\tgprintf        |\n\t\t\t\t\t\tsprintf        |\n\t\t\t\t\t\tstrlen         |\n\t\t\t\t\t\tstrstrt        |\n\t\t\t\t\t\tsubstr         |\n\t\t\t\t\t\tstrftime       |\n\t\t\t\t\t\tstrptime       |\n\t\t\t\t\t\tsystem         |\n\t\t\t\t\t\tword           |\n\t\t\t\t\t\twords\n\t\t\t\t\t)\\b"
        },
        {
          "name": "support.function.other.gnuplot",
          "match": "\\b(?x:\n\t\t\t\t\t\tcolumn         |\n\t\t\t\t\t\tcolumnhead     |\n\t\t\t\t\t\texists         |\n\t\t\t\t\t\thsv2rgb        |\n\t\t\t\t\t\tstringcolumn   |\n\t\t\t\t\t\ttimecolumn     |\n\t\t\t\t\t\ttm_hour        |\n\t\t\t\t\t\ttm_mday        |\n\t\t\t\t\t\ttm_min         |\n\t\t\t\t\t\ttm_mon         |\n\t\t\t\t\t\ttm_sec         |\n\t\t\t\t\t\ttm_wday        |\n\t\t\t\t\t\ttm_yday        |\n\t\t\t\t\t\ttm_year        |\n\t\t\t\t\t\ttime           |\n\t\t\t\t\t\tvalid          |\n\t\t\t\t\t\tvalue\n\t\t\t\t\t)\\b"
        }
      ]
    },
    "Literal": {
      "patterns": [
        {
          "include": "#NumberLiteral"
        },
        {
          "include": "#DeprecatedScriptArgsLiteral"
        },
        {
          "include": "#SingleQuotedStringLiteral"
        },
        {
          "include": "#DoubleQuotedStringLiteral"
        },
        {
          "include": "#InterpolatedStringLiteral"
        }
      ]
    },
    "NumberLiteral": {
      "patterns": [
        {
          "name": "constant.numeric.float.gnuplot",
          "match": "(?x:\n\t\t\t\t\t\t# .5e2 and 0.5e2\n\t\t\t\t\t\t( ((\\b[0-9]+)|(?<!\\d)) )           # number or not a preceding digit\n\t\t\t\t\t\t( [.][0-9]+ )                         # non-optional fractional\n\t\t\t\t\t\t( [Ee][+-]?[0-9]+ )?                  # optional exponent\n\t\t\t\t\t)(cm|in)?\\b"
        },
        {
          "name": "constant.numeric.float.gnuplot",
          "match": "(?x:\n\t\t\t\t\t\t# 5e2 and 5.e2\n\t\t\t\t\t\t( \\b[0-9]+ )                          # non-optional number\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(     ( [Ee][+-]?[0-9]+\\b )  ) |  # non-optional exponent\n\t\t\t\t\t\t\t( [.] ( [Ee][+-]?[0-9]+\\b )? )    # point and optional exponent\n\t\t\t\t\t\t)\n\t\t\t\t\t)(cm\\b|in\\b)?"
        },
        {
          "name": "constant.numeric.hex.gnuplot",
          "match": "\\b(0[Xx][0-9a-fA-F]+)(cm|in)?\\b"
        },
        {
          "name": "constant.numeric.dec.gnuplot",
          "match": "\\b(0+)(cm|in)?\\b"
        },
        {
          "name": "constant.numeric.oct.gnuplot",
          "match": "\\b(0[0-7]+)(cm|in)?\\b"
        },
        {
          "name": "invalid.illegal.oct.gnuplot",
          "match": "\\b(0[0-9]+)(cm|in)?\\b"
        },
        {
          "name": "constant.numeric.dec.gnuplot",
          "match": "\\b([0-9]+)(cm|in)?\\b"
        }
      ]
    },
    "ColumnIndexLiteral": {
      "name": "support.constant.columnindex.gnuplot",
      "match": "([$][0-9]+)\\b"
    },
    "DeprecatedScriptArgsLiteral": {
      "name": "invalid.illegal.scriptargs.gnuplot",
      "match": "([$][0-9#])"
    },
    "SingleQuotedStringLiteral": {
      "name": "string.quoted.single.gnuplot",
      "begin": "(')",
      "beginCaptures": {
        "1": {
          "name": "punctuation.definition.string.begin.gnuplot"
        }
      },
      "end": "((')(?!')|(?=(?<!\\\\)\\n$))",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.string.end.gnuplot"
        }
      },
      "patterns": [
        {
          "include": "#RGBColorSpec"
        },
        {
          "name": "constant.character.escape.gnuplot",
          "match": "('')"
        }
      ]
    },
    "DoubleQuotedStringLiteral": {
      "name": "string.quoted.double.gnuplot",
      "begin": "(\")",
      "beginCaptures": {
        "1": {
          "name": "punctuation.definition.string.begin.gnuplot"
        }
      },
      "end": "((\")|(?=(?<!\\\\)\\n$))",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.string.end.gnuplot"
        }
      },
      "patterns": [
        {
          "include": "#EscapedChar"
        },
        {
          "include": "#RGBColorSpec"
        },
        {
          "include": "#DeprecatedScriptArgsLiteral"
        },
        {
          "include": "#InterpolatedStringLiteral"
        }
      ]
    },
    "InterpolatedStringLiteral": {
      "name": "string.interpolated.gnuplot",
      "begin": "(`)",
      "beginCaptures": {
        "1": {
          "name": "punctuation.definition.string.begin.gnuplot"
        }
      },
      "end": "((`)|(?=(?<!\\\\)\\n$))",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.string.end.gnuplot"
        }
      },
      "patterns": [
        {
          "include": "#EscapedChar"
        }
      ]
    },
    "RGBColorSpec": {
      "name": "constant.other.placeholder.gnuplot",
      "match": "\\G(0x|#)(([0-9a-fA-F]{6})|([0-9a-fA-F]{8}))\\b"
    },
    "EscapedChar": {
      "name": "constant.character.escape.gnuplot",
      "match": "(\\\\.)"
    },
    "LineComment": {
      "name": "comment.line.number-sign.gnuplot",
      "begin": "(#)",
      "beginCaptures": {
        "1": {
          "name": "punctuation.definition.comment.begin.gnuplot"
        }
      },
      "end": "(?=(?<!\\\\)\\n$)",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.comment.end.gnuplot"
        }
      }
    }
  }
}
