# Java syntax file for Diffuse
# Copyright (C) 2008-2011 Derrick Moser <derrick_moser@yahoo.com>
syntax Java normal text
syntax_files Java '\.java$'

# colours
colour java_comment 0.2 0.4 0.64
colour java_fixme 1.0 0.5 0.0
colour java_import 0.46 0.31 0.48
colour java_keyword 0.77 0.63 0.0
colour java_type 0.3 0.6 0.02
colour java_literal 1.0 0.2 0.8
colour java_string 0.8 0.0 0.0
colour java_escapedchar 0.46 0.31 0.48
colour java_punctuation 0.5 0.5 0.5

# whitespace
syntax_pattern normal normal text '[ \t\r\n]+'

# C++ style comments
syntax_pattern normal cpp_comment java_comment '//'
syntax_pattern cpp_comment normal java_comment '(\r\n|\r|\n)$'
syntax_pattern cpp_comment cpp_comment java_comment '\\(\r\n|\r|\n)$'
syntax_pattern cpp_comment cpp_comment java_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern cpp_comment cpp_comment java_comment '.[^\\TFX\r\n]*'

# C style comments
syntax_pattern normal comment java_comment '/\*'
syntax_pattern comment normal java_comment '\*/'
syntax_pattern comment comment java_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern comment comment java_comment '.[^\*TFX]*'

# char
syntax_pattern normal char java_string "'"
syntax_pattern char normal java_string "'"
syntax_pattern char char java_escapedchar '(\\([0-7]{1,3}|x[0-9a-f]{1,2}|u[0-9a-f]{1,4}|.))+' ignorecase
syntax_pattern char char java_string ".[^\\\\']*"

# string
syntax_pattern normal string java_string '"'
syntax_pattern string normal java_string '"'
syntax_pattern string string java_escapedchar '(\\([0-7]{1,3}|x[0-9a-f]{1,2}|u[0-9a-f]{1,4}|.))+' ignorecase
syntax_pattern string string java_string '.[^\\"]*'

# literals
syntax_pattern normal normal java_literal '((([0-9]+\.[0-9]*|\.[0-9]+)(e[\+\-]?[0-9]+)?|[0-9]+e[\+\-]?[0-9]+)[fd]?|(0|[1-9][0-9]*)[fd]|(0x[0-9a-f]+|0[0-7]*|[1-9][0-9]*)l?)' ignorecase
syntax_pattern normal normal java_literal '\b(true|false|null)\b'

# import keywords
syntax_pattern normal normal java_import '\b(import|package)\b'

# typing keywords
syntax_pattern normal normal java_type '\b(abstract|boolean|byte|char|class|const|double|enum|extends|final|float|implements|int|interface|long|native|private|protected|public|short|static|strictfp|synchronized|throws|transient|void|volatile)\b'

# keywords
syntax_pattern normal normal java_keyword '\b(assert|break|case|catch|continue|default|do|else|finally|for|goto|if|instanceof|new|return|super|switch|this|throw|try|while)\b'

# punctuation
syntax_pattern normal normal java_punctuation '[!~%\|\&\^\(\)\<\>\*\-\+=\{\}\[\]:;,\?]+'
syntax_pattern normal normal java_punctuation '[/\.]'

# parsing optimisation
syntax_pattern normal normal text '[a-z_][a-z_0-9]*' ignorecase
