# Style sheet for JavaScript
# Copyright (C) 1999 Scott Pakin

#
# This file is part of a2ps.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, see
# <https://www.gnu.org/licenses/gpl-3.0.html>.
#

style JavaScript is
written by "Scott Pakin <pakin@uiuc.edu>"
version is 1.1
requires a2ps version 4.12g

first alphabet is
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"
second alphabet is
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"
case sensitive

documentation is
  "Keywords used are everything listed in the Client-Side JavaScript"
  "Reference 1.3, plus \"undefined\" (why isn't that listed?) and"
  "\"prototype\".  I omitted the semi-standard a2ps optional operators for"
  "equality, because JavaScript's use of both strict- and non-strict equality"
  "might ambiguate the output.  Finally, regular expressions are formatted"
  "like strings."
end documentation

keywords in Keyword are
   abstract, boolean, byte, char, const, debugger, double, false, float,
   int, long, null, prototype, short, this, true, undefined, void
end keywords

keywords in Keyword_strong are
   break, "case", catch, class, continue, default, delete, do, else, enum,
   export, extends, final, finally, for, goto, if, implements, import,
   "in", instanceof, interface, native, new, package, private, protected,
   public, return, static, super, switch, synchronized, throw, throws,
   transient, try, typeof, var, volatile, while, with
end keywords

operators are
   (/(function)([[:blank:]]+)([^ \t(]+)/
     \1 Keyword_strong, \2 Plain, \3 Label)
end operators

optional operators are
   # Actual
   && \wedge,
   || \vee,
   <= \leq,
   >= \geq,
   ! \not,
   # Protected from the above
   <<<=,
   <<=,
   >>=,
   >>>=,
   !=,
   !==
end operators

sequences are
   # Regular expressions
   (/(=)/                   # \1 = assignment
    /([[:blank:]]+)/        # \2 = spaces
    /(\/)/                  # \3 = "/"
    /([^*\/])/              # \4 = first character of regexp
    \1 Plain, \2 Plain, \3 Plain, \4 String) String "/" Plain
      exceptions are
         "\\\\", "\\/"
      end exceptions,
   "/*" Comment Comment "*/" Comment,
   "//" Comment,
   C-string,
   "'" Plain String "'" Plain
      exceptions are
         "\\\\", "\\'"
      end exceptions
end sequences
end style
