diff options
36 files changed, 3292 insertions, 350 deletions
@@ -110,6 +110,7 @@ Other contributors, listed alphabetically, are: * Jon Larimer, Google Inc. -- Smali lexer * Olov Lassus -- Dart lexer * Matt Layman -- TAP lexer +* Kristian Lyngstøl -- Varnish lexers * Sylvestre Ledru -- Scilab lexer * Mark Lee -- Vala lexer * Valentin Lorentz -- C++ lexer improvements @@ -156,6 +157,7 @@ Other contributors, listed alphabetically, are: * Corey Richardson -- Rust lexer updates * Lubomir Rintel -- GoodData MAQL and CL lexers * Andre Roberge -- Tango style +* Michiel Roos -- TypoScript lexer * Konrad Rudolph -- LaTeX formatter enhancements * Mario Ruggier -- Evoque lexers * Miikka Salminen -- Lovelace style, Hexdump lexer, lexer enhancements @@ -186,6 +188,7 @@ Other contributors, listed alphabetically, are: * Abe Voelker -- OpenEdge ABL lexer * Pepijn de Vos -- HTML formatter CTags support * Matthias Vallentin -- Bro lexer +* Benoît Vinot -- AMPL lexer * Linh Vu Hong -- RSL lexer * Nathan Weizenbaum -- Haml and Sass lexers * Nathan Whetsell -- Csound lexers @@ -7,6 +7,28 @@ pull request numbers to the requests at <https://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged>. +Version 2.2 +----------- +(in development) + +- Added lexers: + + * AMPL + * TypoScript (#1173) + * Varnish config (PR#554) + +- Added `lexers.find_lexer_class_by_name()` (#1203) + +- Added new token types and lexing for magic methods and variables in Python + and PHP. + +- Added a new token type for string affixes and lexing for them in Python, C++ + and Postgresql lexers. + +- Added a new token type for heredoc (and similar) string delimiters and + lexing for them in C++, Perl, PHP, Postgresql and Ruby lexers. + + Version 2.1.1 ------------- (relased Feb 14, 2016) diff --git a/doc/docs/api.rst b/doc/docs/api.rst index 123a4643..dd831bd1 100644 --- a/doc/docs/api.rst +++ b/doc/docs/api.rst @@ -89,6 +89,21 @@ Functions from :mod:`pygments.lexers`: .. versionadded:: 0.6 +.. function:: find_lexer_class_by_name(alias) + + Return the `Lexer` subclass that has `alias` in its aliases list, without + instantiating it. + + Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is + found. + + .. versionadded:: 2.2 + +.. function:: find_lexer_class(name) + + Return the `Lexer` subclass that with the *name* attribute as given by + the *name* argument. + .. module:: pygments.formatters diff --git a/doc/docs/tokens.rst b/doc/docs/tokens.rst index 6455a501..801fc638 100644 --- a/doc/docs/tokens.rst +++ b/doc/docs/tokens.rst @@ -174,6 +174,10 @@ Name Tokens `Name.Function` Token type for function names. +`Name.Function.Magic` + same as `Name.Function` but for special function names that have an implicit use + in a language (e.g. ``__init__`` method in Python). + `Name.Label` Token type for label names (e.g. in languages that support ``goto``). @@ -201,6 +205,10 @@ Name Tokens `Name.Variable.Instance` same as `Name.Variable` but for instance variables. +`Name.Variable.Magic` + same as `Name.Variable` but for special variable names that have an implicit use + in a language (e.g. ``__doc__`` in Python). + Literals ======== @@ -215,12 +223,20 @@ Literals `String` For any string literal. +`String.Affix` + Token type for affixes that further specify the type of the string they're + attached to (e.g. the prefixes ``r`` and ``u8`` in ``r"foo"`` and ``u8"foo"``). + `String.Backtick` Token type for strings enclosed in backticks. `String.Char` Token type for single characters (e.g. Java, C). +`String.Delimiter` + Token type for delimiting identifiers in "heredoc", raw and other similar + strings (e.g. the word ``END`` in Perl code ``print <<'END';``). + `String.Doc` Token type for documentation strings (for example Python). diff --git a/doc/languages.rst b/doc/languages.rst index a495d15c..ffe1bdb6 100644 --- a/doc/languages.rst +++ b/doc/languages.rst @@ -31,6 +31,7 @@ Programming languages * Dart * Delphi * Dylan +* `Elm <http://elm-lang.org/>`_ * Erlang * `Ezhil <http://ezhillang.org>`_ Ezhil - A Tamil programming language * Factor diff --git a/pygments/__init__.py b/pygments/__init__.py index 0c17500e..e825aa39 100644 --- a/pygments/__init__.py +++ b/pygments/__init__.py @@ -26,7 +26,7 @@ :license: BSD, see LICENSE for details. """ -__version__ = '2.1.1' +__version__ = '2.2a0' __docformat__ = 'restructuredtext' __all__ = ['lex', 'format', 'highlight'] diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py index 7d0b89d4..d64f163f 100644 --- a/pygments/lexers/__init__.py +++ b/pygments/lexers/__init__.py @@ -72,6 +72,28 @@ def find_lexer_class(name): return cls +def find_lexer_class_by_name(alias): + """Lookup a lexer class by alias. + + Like `get_lexer_by_name`, but does not instantiate the class. + + .. versionadded:: 2.2 + """ + if not _alias: + raise ClassNotFound('no lexer for alias %r found' % _alias) + # lookup builtin lexers + for module_name, name, aliases, _, _ in itervalues(LEXERS): + if _alias.lower() in aliases: + if name not in _lexer_cache: + _load_lexers(module_name) + return _lexer_cache[name] + # continue with lexers from setuptools entrypoints + for cls in find_plugin_lexers(): + if _alias.lower() in cls.aliases: + return cls + raise ClassNotFound('no lexer for alias %r found' % _alias) + + def get_lexer_by_name(_alias, **options): """Get a lexer by an alias. diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 090e7a92..a414a565 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -26,6 +26,7 @@ LEXERS = { 'AgdaLexer': ('pygments.lexers.haskell', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)), 'AlloyLexer': ('pygments.lexers.dsls', 'Alloy', ('alloy',), ('*.als',), ('text/x-alloy',)), 'AmbientTalkLexer': ('pygments.lexers.ambient', 'AmbientTalk', ('at', 'ambienttalk', 'ambienttalk/2'), ('*.at',), ('text/x-ambienttalk',)), + 'AmplLexer': ('pygments.lexers.ampl', 'Ampl', ('ampl',), ('*.run',), ()), 'AntlrActionScriptLexer': ('pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-as', 'antlr-actionscript'), ('*.G', '*.g'), ()), 'AntlrCSharpLexer': ('pygments.lexers.parsers', 'ANTLR With C# Target', ('antlr-csharp', 'antlr-c#'), ('*.G', '*.g'), ()), 'AntlrCppLexer': ('pygments.lexers.parsers', 'ANTLR With CPP Target', ('antlr-cpp',), ('*.G', '*.g'), ()), @@ -391,7 +392,12 @@ LEXERS = { 'TwigHtmlLexer': ('pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)), 'TwigLexer': ('pygments.lexers.templates', 'Twig', ('twig',), (), ('application/x-twig',)), 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('ts', 'typescript'), ('*.ts',), ('text/x-typescript',)), + 'TypoScriptCssDataLexer': ('pygments.lexers.typoscript', 'TypoScriptCssData', ('typoscriptcssdata',), (), ()), + 'TypoScriptHtmlDataLexer': ('pygments.lexers.typoscript', 'TypoScriptHtmlData', ('typoscripthtmldata',), (), ()), + 'TypoScriptLexer': ('pygments.lexers.typoscript', 'TypoScript', ('typoscript',), ('*.ts', '*.txt'), ('text/x-typoscript',)), 'UrbiscriptLexer': ('pygments.lexers.urbi', 'UrbiScript', ('urbiscript',), ('*.u',), ('application/x-urbiscript',)), + 'VCLLexer': ('pygments.lexers.varnish', 'VCL', ('vcl',), ('*.vcl',), ('text/x-vclsrc',)), + 'VCLSnippetLexer': ('pygments.lexers.varnish', 'VCLSnippets', ('vclsnippets', 'vclsnippet'), (), ('text/x-vclsnippet',)), 'VCTreeStatusLexer': ('pygments.lexers.console', 'VCTreeStatus', ('vctreestatus',), (), ()), 'VGLLexer': ('pygments.lexers.dsls', 'VGL', ('vgl',), ('*.rpf',), ()), 'ValaLexer': ('pygments.lexers.c_like', 'Vala', ('vala', 'vapi'), ('*.vala', '*.vapi'), ('text/x-vala',)), diff --git a/pygments/lexers/ampl.py b/pygments/lexers/ampl.py new file mode 100644 index 00000000..f57b486f --- /dev/null +++ b/pygments/lexers/ampl.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.ampl + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for the ampl language. <http://ampl.com/> + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, using, this +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + + +__all__ = ['AmplLexer'] + + +class AmplLexer(RegexLexer): + """ + For AMPL source code. + + .. versionadded:: 2.2 + """ + name = 'Ampl' + aliases = ['ampl'] + filenames = ['*.run'] + + tokens = { + 'root':[ + (r'\n', Text), + (r'\s+', Text.Whitespace), + (r'#.*?\n', Comment.Single), + (r'/[*](.|\n)*?[*]/', Comment.Multiline), + (r'(call|cd|close|commands|data|delete|display|drop|end|environ|' + r'exit|expand|include|load|model|objective|option|problem|purge|' + r'quit|redeclare|reload|remove|reset|restore|shell|show|solexpand|' + r'solution|solve|update|unload|xref|' + r'coeff|coef|cover|obj|interval|' + r'default|from|to|to_come|net_in|net_out|dimen|dimension|' + r'check|complements|write|end|function|pipe|' + r'format|if|then|else|in|while|repeat|for)\b', Keyword.Reserved), + (r'(integer|binary|symbolic|ordered|circular|reversed|IN|INOUT|OUT|LOCAL)', + Keyword.Type), + (r'\".*?\"', String.Double), + (r'\'.*?\'', String.Single), + (r'[()\[\]{},;:]+', Punctuation), + (r'\b(\w+)(\.)(astatus|init|init0|lb|lb0|lb1|lb2|lrc|' + r'lslack|rc|relax|slack|sstatus|status|ub|ub0|ub1|' + r'ub2|urc|uslack|val)', + bygroups(Name.Variable, Punctuation, Keyword.Reserved)), + (r'(set|param|var|arc|minimize|maximize|subject to|s\.t\.|subj to|' + r'node|table|suffix|read table|write table)(\s+)(\w+)', + bygroups(Keyword.Declaration, Text, Name.Variable)), + (r'(param)(\s*)(:)(\s*)(\w+)(\s*)(:)(\s*)((\w|\s)+)', + bygroups(Keyword.Declaration, Text, Punctuation, Text, + Name.Variable, Text, Punctuation, Text, Name.Variable)), + (r'(let|fix|unfix)(\s*)(\{.*\}|)(\s*)(\w+)', + bygroups(Keyword.Declaration, Text, using(this), Text, Name.Variable)), + (r'\b(abs|acos|acosh|alias|' + r'asin|asinh|atan|atan2|atanh|ceil|ctime|cos|exp|floor|log|log10|' + r'max|min|precision|round|sin|sinh|sqrt|tan|tanh|time|trunc|Beta|' + r'Cauchy|Exponential|Gamma|Irand224|Normal|Normal01|Poisson|Uniform|Uniform01|' + r'num|num0|ichar|char|length|substr|sprintf|match|sub|gsub|print|printf' + r'next|nextw|prev|prevw|first|last|ord|ord0|card|arity|indexarity)\b', + Name.Builtin), + (r'(\+|\-|\*|/|\*\*|=|<=|>=|==|\||\^|<|>|\!|\.\.|:=|\&|\!=|<<|>>)', + Operator), + (r'(or|exists|forall|and|in|not|within|union|diff|' + r'difference|symdiff|inter|intersect|intersection|' + r'cross|setof|by|less|sum|prod|product|div|mod)', + Keyword.Reserved), #Operator.Name but not enough emphasized with Operator.Name + (r'(\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?', Number.Float), + (r'\d+([eE][+-]?\d+)?', Number.Integer), + (r'[+-]?Infinity', Number.Integer), + (r'(\w+|(\.(?!\.)))', Text) + ] + + } diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py index 5c724d03..2f77158b 100644 --- a/pygments/lexers/c_cpp.py +++ b/pygments/lexers/c_cpp.py @@ -50,8 +50,9 @@ class CFamilyLexer(RegexLexer): (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), ], 'statements': [ - (r'L?"', String, 'string'), - (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r'(L?)(")', bygroups(String.Affix, String), 'string'), + (r"(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')", + bygroups(String.Affix, String.Char, String.Char, String.Char)), (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float), (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex), @@ -217,7 +218,11 @@ class CppLexer(CFamilyLexer): (r'char(16_t|32_t)\b', Keyword.Type), (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), # C++11 raw strings - (r'R"\(', String, 'rawstring'), + (r'(R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")', + bygroups(String.Affix, String, String.Delimiter, String.Delimiter, + String, String.Delimiter, String)), + # C++11 UTF-8/16/32 strings + (r'(u8|u|U)(")', bygroups(String.Affix, String), 'string'), inherit, ], 'root': [ @@ -234,11 +239,6 @@ class CppLexer(CFamilyLexer): # template specification (r'\s*(?=>)', Text, '#pop'), ], - 'rawstring': [ - (r'\)"', String, '#pop'), - (r'[^)]+', String), - (r'\)', String), - ], } def analyse_text(text): diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py index d894818d..f4a9c299 100644 --- a/pygments/lexers/c_like.py +++ b/pygments/lexers/c_like.py @@ -427,115 +427,115 @@ class ArduinoLexer(CppLexer): filenames = ['*.ino'] mimetypes = ['text/x-arduino'] - # Language constants - constants = set(('DIGITAL_MESSAGE', 'FIRMATA_STRING', 'ANALOG_MESSAGE', - 'REPORT_DIGITAL', 'REPORT_ANALOG', 'INPUT_PULLUP', - 'SET_PIN_MODE', 'INTERNAL2V56', 'SYSTEM_RESET', 'LED_BUILTIN', - 'INTERNAL1V1', 'SYSEX_START', 'INTERNAL', 'EXTERNAL', - 'DEFAULT', 'OUTPUT', 'INPUT', 'HIGH', 'LOW')) - # Language sketch main structure functions structure = set(('setup', 'loop')) - # Language variable types - storage = set(('boolean', 'const', 'byte', 'word', 'string', 'String', 'array')) + # Language operators + operators = set(('not', 'or', 'and', 'xor')) + + # Language 'variables' + variables = set(( + 'DIGITAL_MESSAGE', 'FIRMATA_STRING', 'ANALOG_MESSAGE', 'REPORT_DIGITAL', + 'REPORT_ANALOG', 'INPUT_PULLUP', 'SET_PIN_MODE', 'INTERNAL2V56', 'SYSTEM_RESET', + 'LED_BUILTIN', 'INTERNAL1V1', 'SYSEX_START', 'INTERNAL', 'EXTERNAL', 'HIGH', + 'LOW', 'INPUT', 'OUTPUT', 'INPUT_PULLUP', 'LED_BUILTIN', 'true', 'false', + 'void', 'boolean', 'char', 'unsigned char', 'byte', 'int', 'unsigned int', + 'word', 'long', 'unsigned long', 'short', 'float', 'double', 'string', 'String', + 'array', 'static', 'volatile', 'const', 'boolean', 'byte', 'word', 'string', + 'String', 'array', 'int', 'float', 'private', 'char', 'virtual', 'operator', + 'sizeof', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int8_t', 'int16_t', + 'int32_t', 'int64_t', 'dynamic_cast', 'typedef', 'const_cast', 'const', + 'struct', 'static_cast', 'union', 'unsigned', 'long', 'volatile', 'static', + 'protected', 'bool', 'public', 'friend', 'auto', 'void', 'enum', 'extern', + 'class', 'short', 'reinterpret_cast', 'double', 'register', 'explicit', + 'signed', 'inline', 'delete', '_Bool', 'complex', '_Complex', '_Imaginary', + 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short', + 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong', + 'atomic_llong', 'atomic_ullong', 'PROGMEM')) # Language shipped functions and class ( ) - functions = set(('KeyboardController', 'MouseController', 'SoftwareSerial', - 'EthernetServer', 'EthernetClient', 'LiquidCrystal', - 'RobotControl', 'GSMVoiceCall', 'EthernetUDP', 'EsploraTFT', - 'HttpClient', 'RobotMotor', 'WiFiClient', 'GSMScanner', - 'FileSystem', 'Scheduler', 'GSMServer', 'YunClient', 'YunServer', - 'IPAddress', 'GSMClient', 'GSMModem', 'Keyboard', 'Ethernet', - 'Console', 'GSMBand', 'Esplora', 'Stepper', 'Process', - 'WiFiUDP', 'GSM_SMS', 'Mailbox', 'USBHost', 'Firmata', 'PImage', - 'Client', 'Server', 'GSMPIN', 'FileIO', 'Bridge', 'Serial', - 'EEPROM', 'Stream', 'Mouse', 'Audio', 'Servo', 'File', 'Task', - 'GPRS', 'WiFi', 'Wire', 'TFT', 'GSM', 'SPI', 'SD', - 'runShellCommandAsynchronously', 'analogWriteResolution', - 'retrieveCallingNumber', 'printFirmwareVersion', - 'analogReadResolution', 'sendDigitalPortPair', - 'noListenOnLocalhost', 'readJoystickButton', 'setFirmwareVersion', - 'readJoystickSwitch', 'scrollDisplayRight', 'getVoiceCallStatus', - 'scrollDisplayLeft', 'writeMicroseconds', 'delayMicroseconds', - 'beginTransmission', 'getSignalStrength', 'runAsynchronously', - 'getAsynchronously', 'listenOnLocalhost', 'getCurrentCarrier', - 'readAccelerometer', 'messageAvailable', 'sendDigitalPorts', - 'lineFollowConfig', 'countryNameWrite', 'runShellCommand', - 'readStringUntil', 'rewindDirectory', 'readTemperature', - 'setClockDivider', 'readLightSensor', 'endTransmission', - 'analogReference', 'detachInterrupt', 'countryNameRead', - 'attachInterrupt', 'encryptionType', 'readBytesUntil', - 'robotNameWrite', 'readMicrophone', 'robotNameRead', 'cityNameWrite', - 'userNameWrite', 'readJoystickY', 'readJoystickX', 'mouseReleased', - 'openNextFile', 'scanNetworks', 'noInterrupts', 'digitalWrite', - 'beginSpeaker', 'mousePressed', 'isActionDone', 'mouseDragged', - 'displayLogos', 'noAutoscroll', 'addParameter', 'remoteNumber', - 'getModifiers', 'keyboardRead', 'userNameRead', 'waitContinue', - 'processInput', 'parseCommand', 'printVersion', 'readNetworks', - 'writeMessage', 'blinkVersion', 'cityNameRead', 'readMessage', - 'setDataMode', 'parsePacket', 'isListening', 'setBitOrder', - 'beginPacket', 'isDirectory', 'motorsWrite', 'drawCompass', - 'digitalRead', 'clearScreen', 'serialEvent', 'rightToLeft', - 'setTextSize', 'leftToRight', 'requestFrom', 'keyReleased', - 'compassRead', 'analogWrite', 'interrupts', 'WiFiServer', - 'disconnect', 'playMelody', 'parseFloat', 'autoscroll', - 'getPINUsed', 'setPINUsed', 'setTimeout', 'sendAnalog', - 'readSlider', 'analogRead', 'beginWrite', 'createChar', - 'motorsStop', 'keyPressed', 'tempoWrite', 'readButton', - 'subnetMask', 'debugPrint', 'macAddress', 'writeGreen', - 'randomSeed', 'attachGPRS', 'readString', 'sendString', - 'remotePort', 'releaseAll', 'mouseMoved', 'background', - 'getXChange', 'getYChange', 'answerCall', 'getResult', - 'voiceCall', 'endPacket', 'constrain', 'getSocket', 'writeJSON', - 'getButton', 'available', 'connected', 'findUntil', 'readBytes', - 'exitValue', 'readGreen', 'writeBlue', 'startLoop', 'IPAddress', - 'isPressed', 'sendSysex', 'pauseMode', 'gatewayIP', 'setCursor', - 'getOemKey', 'tuneWrite', 'noDisplay', 'loadImage', 'switchPIN', - 'onRequest', 'onReceive', 'changePIN', 'playFile', 'noBuffer', - 'parseInt', 'overflow', 'checkPIN', 'knobRead', 'beginTFT', - 'bitClear', 'updateIR', 'bitWrite', 'position', 'writeRGB', - 'highByte', 'writeRed', 'setSpeed', 'readBlue', 'noStroke', - 'remoteIP', 'transfer', 'shutdown', 'hangCall', 'beginSMS', - 'endWrite', 'attached', 'maintain', 'noCursor', 'checkReg', - 'checkPUK', 'shiftOut', 'isValid', 'shiftIn', 'pulseIn', - 'connect', 'println', 'localIP', 'pinMode', 'getIMEI', - 'display', 'noBlink', 'process', 'getBand', 'running', 'beginSD', - 'drawBMP', 'lowByte', 'setBand', 'release', 'bitRead', 'prepare', - 'pointTo', 'readRed', 'setMode', 'noFill', 'remove', 'listen', - 'stroke', 'detach', 'attach', 'noTone', 'exists', 'buffer', - 'height', 'bitSet', 'circle', 'config', 'cursor', 'random', - 'IRread', 'sizeof', 'setDNS', 'endSMS', 'getKey', 'micros', - 'millis', 'begin', 'print', 'write', 'ready', 'flush', 'width', - 'isPIN', 'blink', 'clear', 'press', 'mkdir', 'rmdir', 'close', - 'point', 'yield', 'image', 'float', 'BSSID', 'click', 'delay', - 'read', 'text', 'move', 'peek', 'beep', 'rect', 'line', 'open', - 'seek', 'fill', 'size', 'turn', 'stop', 'home', 'find', 'char', - 'byte', 'step', 'word', 'long', 'tone', 'sqrt', 'RSSI', 'SSID', - 'end', 'bit', 'tan', 'cos', 'sin', 'pow', 'map', 'abs', 'max', - 'min', 'int', 'get', 'run', 'put')) - + functions = set(( + 'KeyboardController', 'MouseController', 'SoftwareSerial', 'EthernetServer', + 'EthernetClient', 'LiquidCrystal', 'RobotControl', 'GSMVoiceCall', + 'EthernetUDP', 'EsploraTFT', 'HttpClient', 'RobotMotor', 'WiFiClient', + 'GSMScanner', 'FileSystem', 'Scheduler', 'GSMServer', 'YunClient', 'YunServer', + 'IPAddress', 'GSMClient', 'GSMModem', 'Keyboard', 'Ethernet', 'Console', + 'GSMBand', 'Esplora', 'Stepper', 'Process', 'WiFiUDP', 'GSM_SMS', 'Mailbox', + 'USBHost', 'Firmata', 'PImage', 'Client', 'Server', 'GSMPIN', 'FileIO', + 'Bridge', 'Serial', 'EEPROM', 'Stream', 'Mouse', 'Audio', 'Servo', 'File', + 'Task', 'GPRS', 'WiFi', 'Wire', 'TFT', 'GSM', 'SPI', 'SD', + 'runShellCommandAsynchronously', 'analogWriteResolution', + 'retrieveCallingNumber', 'printFirmwareVersion', 'analogReadResolution', + 'sendDigitalPortPair', 'noListenOnLocalhost', 'readJoystickButton', + 'setFirmwareVersion', 'readJoystickSwitch', 'scrollDisplayRight', + 'getVoiceCallStatus', 'scrollDisplayLeft', 'writeMicroseconds', + 'delayMicroseconds', 'beginTransmission', 'getSignalStrength', + 'runAsynchronously', 'getAsynchronously', 'listenOnLocalhost', + 'getCurrentCarrier', 'readAccelerometer', 'messageAvailable', + 'sendDigitalPorts', 'lineFollowConfig', 'countryNameWrite', 'runShellCommand', + 'readStringUntil', 'rewindDirectory', 'readTemperature', 'setClockDivider', + 'readLightSensor', 'endTransmission', 'analogReference', 'detachInterrupt', + 'countryNameRead', 'attachInterrupt', 'encryptionType', 'readBytesUntil', + 'robotNameWrite', 'readMicrophone', 'robotNameRead', 'cityNameWrite', + 'userNameWrite', 'readJoystickY', 'readJoystickX', 'mouseReleased', + 'openNextFile', 'scanNetworks', 'noInterrupts', 'digitalWrite', 'beginSpeaker', + 'mousePressed', 'isActionDone', 'mouseDragged', 'displayLogos', 'noAutoscroll', + 'addParameter', 'remoteNumber', 'getModifiers', 'keyboardRead', 'userNameRead', + 'waitContinue', 'processInput', 'parseCommand', 'printVersion', 'readNetworks', + 'writeMessage', 'blinkVersion', 'cityNameRead', 'readMessage', 'setDataMode', + 'parsePacket', 'isListening', 'setBitOrder', 'beginPacket', 'isDirectory', + 'motorsWrite', 'drawCompass', 'digitalRead', 'clearScreen', 'serialEvent', + 'rightToLeft', 'setTextSize', 'leftToRight', 'requestFrom', 'keyReleased', + 'compassRead', 'analogWrite', 'interrupts', 'WiFiServer', 'disconnect', + 'playMelody', 'parseFloat', 'autoscroll', 'getPINUsed', 'setPINUsed', + 'setTimeout', 'sendAnalog', 'readSlider', 'analogRead', 'beginWrite', + 'createChar', 'motorsStop', 'keyPressed', 'tempoWrite', 'readButton', + 'subnetMask', 'debugPrint', 'macAddress', 'writeGreen', 'randomSeed', + 'attachGPRS', 'readString', 'sendString', 'remotePort', 'releaseAll', + 'mouseMoved', 'background', 'getXChange', 'getYChange', 'answerCall', + 'getResult', 'voiceCall', 'endPacket', 'constrain', 'getSocket', 'writeJSON', + 'getButton', 'available', 'connected', 'findUntil', 'readBytes', 'exitValue', + 'readGreen', 'writeBlue', 'startLoop', 'IPAddress', 'isPressed', 'sendSysex', + 'pauseMode', 'gatewayIP', 'setCursor', 'getOemKey', 'tuneWrite', 'noDisplay', + 'loadImage', 'switchPIN', 'onRequest', 'onReceive', 'changePIN', 'playFile', + 'noBuffer', 'parseInt', 'overflow', 'checkPIN', 'knobRead', 'beginTFT', + 'bitClear', 'updateIR', 'bitWrite', 'position', 'writeRGB', 'highByte', + 'writeRed', 'setSpeed', 'readBlue', 'noStroke', 'remoteIP', 'transfer', + 'shutdown', 'hangCall', 'beginSMS', 'endWrite', 'attached', 'maintain', + 'noCursor', 'checkReg', 'checkPUK', 'shiftOut', 'isValid', 'shiftIn', 'pulseIn', + 'connect', 'println', 'localIP', 'pinMode', 'getIMEI', 'display', 'noBlink', + 'process', 'getBand', 'running', 'beginSD', 'drawBMP', 'lowByte', 'setBand', + 'release', 'bitRead', 'prepare', 'pointTo', 'readRed', 'setMode', 'noFill', + 'remove', 'listen', 'stroke', 'detach', 'attach', 'noTone', 'exists', 'buffer', + 'height', 'bitSet', 'circle', 'config', 'cursor', 'random', 'IRread', 'setDNS', + 'endSMS', 'getKey', 'micros', 'millis', 'begin', 'print', 'write', 'ready', + 'flush', 'width', 'isPIN', 'blink', 'clear', 'press', 'mkdir', 'rmdir', 'close', + 'point', 'yield', 'image', 'BSSID', 'click', 'delay', 'read', 'text', 'move', + 'peek', 'beep', 'rect', 'line', 'open', 'seek', 'fill', 'size', 'turn', 'stop', + 'home', 'find', 'step', 'tone', 'sqrt', 'RSSI', 'SSID', 'end', 'bit', 'tan', + 'cos', 'sin', 'pow', 'map', 'abs', 'max', 'min', 'get', 'run', 'put', + 'isAlphaNumeric', 'isAlpha', 'isAscii', 'isWhitespace', 'isControl', 'isDigit', + 'isGraph', 'isLowerCase', 'isPrintable', 'isPunct', 'isSpace', 'isUpperCase', + 'isHexadecimalDigit')) + + # do not highlight + suppress_highlight = set(( + 'namespace', 'template', 'mutable', 'using', 'asm', 'typeid', + 'typename', 'this', 'alignof', 'constexpr', 'decltype', 'noexcept', + 'static_assert', 'thread_local', 'restrict')) + def get_tokens_unprocessed(self, text): for index, token, value in CppLexer.get_tokens_unprocessed(self, text): - if token is Name: - if value in self.constants: - yield index, Keyword.Constant, value - elif value in self.functions: - yield index, Name.Function, value - elif value in self.storage: - yield index, Keyword.Type, value - else: - yield index, token, value - elif token is Name.Function: - if value in self.structure: - yield index, Name.Other, value - else: - yield index, token, value - elif token is Keyword: - if value in self.storage: - yield index, Keyword.Type, value - else: - yield index, token, value + if value in self.structure: + yield index, Name.Builtin, value + elif value in self.operators: + yield index, Operator, value + elif value in self.variables: + yield index, Keyword.Reserved, value + elif value in self.suppress_highlight: + yield index, Name, value + elif value in self.functions: + yield index, Name.Function, value else: yield index, token, value diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py index c46d8bb8..77c7714d 100644 --- a/pygments/lexers/configs.py +++ b/pygments/lexers/configs.py @@ -39,7 +39,9 @@ class IniLexer(RegexLexer): (r'[;#].*', Comment.Single), (r'\[.*?\]$', Keyword), (r'(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)', - bygroups(Name.Attribute, Text, Operator, Text, String)) + bygroups(Name.Attribute, Text, Operator, Text, String)), + # standalone option, supported by some INI parsers + (r'(.+?)$', Name.Attribute), ] } diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py index c353a4dc..7838b3c5 100644 --- a/pygments/lexers/erlang.py +++ b/pygments/lexers/erlang.py @@ -82,7 +82,11 @@ class ErlangLexer(RegexLexer): variable_re = r'(?:[A-Z_]\w*)' - escape_re = r'(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))' + esc_char_re = r'[bdefnrstv\'"\\]' + esc_octal_re = r'[0-7][0-7]?[0-7]?' + esc_hex_re = r'(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})' + esc_ctrl_re = r'\^[a-zA-Z]' + escape_re = r'(?:\\(?:'+esc_char_re+r'|'+esc_octal_re+r'|'+esc_hex_re+r'|'+esc_ctrl_re+r'))' macro_re = r'(?:'+variable_re+r'|'+atom_re+r')' @@ -112,6 +116,13 @@ class ErlangLexer(RegexLexer): (r'\?'+macro_re, Name.Constant), (r'\$(?:'+escape_re+r'|\\[ %]|[^\\])', String.Char), (r'#'+atom_re+r'(:?\.'+atom_re+r')?', Name.Label), + + # Erlang script shebang + (r'\A#!.+\n', Comment.Hashbang), + + # EEP 43: Maps + # http://www.erlang.org/eeps/eep-0043.html + (r'#\{', Punctuation, 'map_key'), ], 'string': [ (escape_re, String.Escape), @@ -127,6 +138,17 @@ class ErlangLexer(RegexLexer): bygroups(Name.Entity, Text, Punctuation, Name.Label), '#pop'), (atom_re, Name.Entity, '#pop'), ], + 'map_key': [ + include('root'), + (r'=>', Punctuation, 'map_val'), + (r':=', Punctuation, 'map_val'), + (r'\}', Punctuation, '#pop'), + ], + 'map_val': [ + include('root'), + (r',', Punctuation, '#pop'), + (r'(?=\})', Punctuation, '#pop'), + ], } diff --git a/pygments/lexers/igor.py b/pygments/lexers/igor.py index b0eaf6aa..17fedf88 100644 --- a/pygments/lexers/igor.py +++ b/pygments/lexers/igor.py @@ -40,7 +40,7 @@ class IgorLexer(RegexLexer): types = ( 'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE', 'STRUCT', 'dfref', 'funcref', 'char', 'uchar', 'int16', 'uint16', 'int32', - 'uint32', 'float', 'double' + 'uint32', 'int64', 'uint64', 'float', 'double' ) keywords = ( 'override', 'ThreadSafe', 'MultiThread', 'static', 'Proc', @@ -48,213 +48,221 @@ class IgorLexer(RegexLexer): 'Structure', 'EndStructure', 'EndMacro', 'Menu', 'SubMenu' ) operations = ( - 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio', - 'AddMovieFrame', 'APMath', 'Append', 'AppendImage', - 'AppendLayoutObject', 'AppendMatrixContour', 'AppendText', - 'AppendToGraph', 'AppendToLayout', 'AppendToTable', 'AppendXYZContour', - 'AutoPositionWindow', 'BackgroundInfo', 'Beep', 'BoundingBall', - 'BrowseURL', 'BuildMenu', 'Button', 'cd', 'Chart', 'CheckBox', - 'CheckDisplayed', 'ChooseColor', 'Close', 'CloseMovie', 'CloseProc', - 'ColorScale', 'ColorTab2Wave', 'Concatenate', 'ControlBar', - 'ControlInfo', 'ControlUpdate', 'ConvexHull', 'Convolve', 'CopyFile', - 'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'Cross', - 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor', - 'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions', - 'DefaultFont', 'DefaultGuiControls', 'DefaultGuiFont', 'DefineGuide', - 'DelayUpdate', 'DeleteFile', 'DeleteFolder', 'DeletePoints', - 'Differentiate', 'dir', 'Display', 'DisplayHelpTopic', - 'DisplayProcedure', 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow', - 'DoXOPIdle', 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine', - 'DrawOval', 'DrawPICT', 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText', - 'DSPDetrend', 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder', - 'DWT', 'EdgeStats', 'Edit', 'ErrorBars', 'Execute', 'ExecuteScriptText', - 'ExperimentModified', 'Extract', 'FastGaussTransform', 'FastOp', - 'FBinRead', 'FBinWrite', 'FFT', 'FIFO2Wave', 'FIFOStatus', 'FilterFIR', - 'FilterIIR', 'FindLevel', 'FindLevels', 'FindPeak', 'FindPointsInPoly', - 'FindRoots', 'FindSequence', 'FindValue', 'FPClustering', 'fprintf', - 'FReadLine', 'FSetPos', 'FStatus', 'FTPDelete', 'FTPDownload', - 'FTPUpload', 'FuncFit', 'FuncFitMD', 'GetAxis', 'GetFileFolderInfo', - 'GetLastUserMenuInfo', 'GetMarquee', 'GetSelection', 'GetWindow', - 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep', 'GroupBox', - 'Hanning', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools', - 'HilbertTransform', 'Histogram', 'IFFT', 'ImageAnalyzeParticles', - 'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection', - 'ImageFileInfo', 'ImageFilter', 'ImageFocus', 'ImageGenerateROIMask', - 'ImageHistModification', 'ImageHistogram', 'ImageInterpolate', - 'ImageLineProfile', 'ImageLoad', 'ImageMorphology', 'ImageRegistration', - 'ImageRemoveBackground', 'ImageRestore', 'ImageRotate', 'ImageSave', - 'ImageSeedFill', 'ImageSnake', 'ImageStats', 'ImageThreshold', - 'ImageTransform', 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort', - 'InsertPoints', 'Integrate', 'IntegrateODE', 'Interp3DPath', - 'Interpolate3D', 'KillBackground', 'KillControl', 'KillDataFolder', - 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs', 'KillStrings', - 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label', 'Layout', - 'Legend', 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData', - 'LoadPackagePreferences', 'LoadPICT', 'LoadWave', 'Loess', - 'LombPeriodogram', 'Make', 'MakeIndex', 'MarkPerfTestTime', - 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV', 'MatrixFilter', - 'MatrixGaussJ', 'MatrixInverse', 'MatrixLinearSolve', - 'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD', - 'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve', - 'MatrixSVBkSub', 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText', - 'Modify', 'ModifyContour', 'ModifyControl', 'ModifyControlList', - 'ModifyFreeAxis', 'ModifyGraph', 'ModifyImage', 'ModifyLayout', - 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall', 'MoveDataFolder', - 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow', 'MoveVariable', - 'MoveWave', 'MoveWindow', 'NeuralNetworkRun', 'NeuralNetworkTrain', - 'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewImage', - 'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath', - 'NewWaterfall', 'Note', 'Notebook', 'NotebookAction', 'Open', - 'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo', - 'PauseForUser', 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction', - 'PlaySnd', 'PlaySound', 'PopupContextualMenu', 'PopupMenu', - 'Preferences', 'PrimeFactors', 'Print', 'printf', 'PrintGraphs', - 'PrintLayout', 'PrintNotebook', 'PrintSettings', 'PrintTable', - 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit', - 'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour', + 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio', 'AddMovieFrame', + 'AdoptFiles', 'APMath', 'Append', 'AppendImage', 'AppendLayoutObject', + 'AppendMatrixContour', 'AppendText', 'AppendToGizmo', 'AppendToGraph', + 'AppendToLayout', 'AppendToTable', 'AppendXYZContour', 'AutoPositionWindow', + 'BackgroundInfo', 'Beep', 'BoundingBall', 'BoxSmooth', 'BrowseURL', 'BuildMenu', + 'Button', 'cd', 'Chart', 'CheckBox', 'CheckDisplayed', 'ChooseColor', 'Close', + 'CloseHelp', 'CloseMovie', 'CloseProc', 'ColorScale', 'ColorTab2Wave', + 'Concatenate', 'ControlBar', 'ControlInfo', 'ControlUpdate', + 'ConvertGlobalStringTextEncoding', 'ConvexHull', 'Convolve', 'CopyFile', + 'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'CreateBrowser', + 'Cross', 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor', + 'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions', 'DefaultFont', + 'DefaultGuiControls', 'DefaultGuiFont', 'DefaultTextEncoding', 'DefineGuide', + 'DelayUpdate', 'DeleteAnnotations', 'DeleteFile', 'DeleteFolder', 'DeletePoints', + 'Differentiate', 'dir', 'Display', 'DisplayHelpTopic', 'DisplayProcedure', + 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow', 'DoXOPIdle', 'DPSS', + 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine', 'DrawOval', 'DrawPICT', + 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText', 'DrawUserShape', 'DSPDetrend', + 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder', 'DWT', 'EdgeStats', 'Edit', + 'ErrorBars', 'EstimatePeakSizes', 'Execute', 'ExecuteScriptText', + 'ExperimentModified', 'ExportGizmo', 'Extract', 'FastGaussTransform', 'FastOp', + 'FBinRead', 'FBinWrite', 'FFT', 'FIFOStatus', 'FIFO2Wave', 'FilterFIR', + 'FilterIIR', 'FindAPeak', 'FindContour', 'FindDuplicates', 'FindLevel', + 'FindLevels', 'FindPeak', 'FindPointsInPoly', 'FindRoots', 'FindSequence', + 'FindValue', 'FPClustering', 'fprintf', 'FReadLine', 'FSetPos', 'FStatus', + 'FTPCreateDirectory', 'FTPDelete', 'FTPDownload', 'FTPUpload', 'FuncFit', + 'FuncFitMD', 'GBLoadWave', 'GetAxis', 'GetCamera', 'GetFileFolderInfo', + 'GetGizmo', 'GetLastUserMenuInfo', 'GetMarquee', 'GetMouse', 'GetSelection', + 'GetWindow', 'GPIBReadBinaryWave2', 'GPIBReadBinary2', 'GPIBReadWave2', + 'GPIBRead2', 'GPIBWriteBinaryWave2', 'GPIBWriteBinary2', 'GPIBWriteWave2', + 'GPIBWrite2', 'GPIB2', 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep', + 'GroupBox', 'Hanning', 'HDF5CloseFile', 'HDF5CloseGroup', 'HDF5ConvertColors', + 'HDF5CreateFile', 'HDF5CreateGroup', 'HDF5CreateLink', 'HDF5Dump', + 'HDF5DumpErrors', 'HDF5DumpState', 'HDF5ListAttributes', 'HDF5ListGroup', + 'HDF5LoadData', 'HDF5LoadGroup', 'HDF5LoadImage', 'HDF5OpenFile', 'HDF5OpenGroup', + 'HDF5SaveData', 'HDF5SaveGroup', 'HDF5SaveImage', 'HDF5TestOperation', + 'HDF5UnlinkObject', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools', + 'HilbertTransform', 'Histogram', 'ICA', 'IFFT', 'ImageAnalyzeParticles', + 'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection', 'ImageFileInfo', + 'ImageFilter', 'ImageFocus', 'ImageFromXYZ', 'ImageGenerateROIMask', 'ImageGLCM', + 'ImageHistModification', 'ImageHistogram', 'ImageInterpolate', 'ImageLineProfile', + 'ImageLoad', 'ImageMorphology', 'ImageRegistration', 'ImageRemoveBackground', + 'ImageRestore', 'ImageRotate', 'ImageSave', 'ImageSeedFill', 'ImageSkeleton3d', + 'ImageSnake', 'ImageStats', 'ImageThreshold', 'ImageTransform', + 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort', 'InsertPoints', 'Integrate', + 'IntegrateODE', 'Integrate2D', 'Interpolate2', 'Interpolate3D', 'Interp3DPath', + 'JCAMPLoadWave', 'JointHistogram', 'KillBackground', 'KillControl', + 'KillDataFolder', 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs', + 'KillStrings', 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label', + 'Layout', 'LayoutPageAction', 'LayoutSlideShow', 'Legend', + 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData', 'LoadPackagePreferences', + 'LoadPICT', 'LoadWave', 'Loess', 'LombPeriodogram', 'Make', 'MakeIndex', + 'MarkPerfTestTime', 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV', + 'MatrixFilter', 'MatrixGaussJ', 'MatrixGLM', 'MatrixInverse', 'MatrixLinearSolve', + 'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD', 'MatrixLUDTD', + 'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve', 'MatrixSVBkSub', + 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText', 'MLLoadWave', 'Modify', + 'ModifyBrowser', 'ModifyCamera', 'ModifyContour', 'ModifyControl', + 'ModifyControlList', 'ModifyFreeAxis', 'ModifyGizmo', 'ModifyGraph', + 'ModifyImage', 'ModifyLayout', 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall', + 'MoveDataFolder', 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow', + 'MoveVariable', 'MoveWave', 'MoveWindow', 'MultiTaperPSD', + 'MultiThreadingControl', 'NeuralNetworkRun', 'NeuralNetworkTrain', 'NewCamera', + 'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewGizmo', 'NewImage', + 'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath', 'NewWaterfall', + 'NI4882', 'Note', 'Notebook', 'NotebookAction', 'Open', 'OpenHelp', + 'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo', 'PauseForUser', + 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction', 'PlaySound', + 'PopupContextualMenu', 'PopupMenu', 'Preferences', 'PrimeFactors', 'Print', + 'printf', 'PrintGraphs', 'PrintLayout', 'PrintNotebook', 'PrintSettings', + 'PrintTable', 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit', + 'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour', 'RemoveFromGizmo', 'RemoveFromGraph', 'RemoveFromLayout', 'RemoveFromTable', 'RemoveImage', - 'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder', - 'RenamePath', 'RenamePICT', 'RenameWindow', 'ReorderImages', - 'ReorderTraces', 'ReplaceText', 'ReplaceWave', 'Resample', - 'ResumeUpdate', 'Reverse', 'Rotate', 'Save', 'SaveData', - 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook', - 'SavePackagePreferences', 'SavePICT', 'SaveTableCopy', - 'SetActiveSubwindow', 'SetAxis', 'SetBackground', 'SetDashPattern', - 'SetDataFolder', 'SetDimLabel', 'SetDrawEnv', 'SetDrawLayer', - 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook', 'SetIgorMenuMode', - 'SetIgorOption', 'SetMarquee', 'SetProcessSleep', 'SetRandomSeed', - 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWindow', 'ShowIgorMenus', - 'ShowInfo', 'ShowTools', 'Silent', 'Sleep', 'Slider', 'Smooth', - 'SmoothCustom', 'Sort', 'SoundInRecord', 'SoundInSet', - 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart', - 'SphericalInterpolate', 'SphericalTriangulate', 'SplitString', - 'sprintf', 'sscanf', 'Stack', 'StackWindows', + 'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder', 'RenamePath', + 'RenamePICT', 'RenameWindow', 'ReorderImages', 'ReorderTraces', 'ReplaceText', + 'ReplaceWave', 'Resample', 'ResumeUpdate', 'Reverse', 'Rotate', 'Save', + 'SaveData', 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook', + 'SavePackagePreferences', 'SavePICT', 'SaveTableCopy', 'SetActiveSubwindow', + 'SetAxis', 'SetBackground', 'SetDashPattern', 'SetDataFolder', 'SetDimLabel', + 'SetDrawEnv', 'SetDrawLayer', 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook', + 'SetIgorMenuMode', 'SetIgorOption', 'SetMarquee', 'SetProcessSleep', + 'SetRandomSeed', 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWaveTextEncoding', + 'SetWindow', 'ShowIgorMenus', 'ShowInfo', 'ShowTools', 'Silent', 'Sleep', + 'Slider', 'Smooth', 'SmoothCustom', 'Sort', 'SortColumns', 'SoundInRecord', + 'SoundInSet', 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart', + 'SoundLoadWave', 'SoundSaveWave', 'SphericalInterpolate', 'SphericalTriangulate', + 'SplitString', 'SplitWave', 'sprintf', 'sscanf', 'Stack', 'StackWindows', 'StatsAngularDistanceTest', 'StatsANOVA1Test', 'StatsANOVA2NRTest', 'StatsANOVA2RMTest', 'StatsANOVA2Test', 'StatsChiTest', - 'StatsCircularCorrelationTest', 'StatsCircularMeans', - 'StatsCircularMoments', 'StatsCircularTwoSampleTest', - 'StatsCochranTest', 'StatsContingencyTable', 'StatsDIPTest', - 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest', - 'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKendallTauTest', + 'StatsCircularCorrelationTest', 'StatsCircularMeans', 'StatsCircularMoments', + 'StatsCircularTwoSampleTest', 'StatsCochranTest', 'StatsContingencyTable', + 'StatsDIPTest', 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest', + 'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKDE', 'StatsKendallTauTest', 'StatsKSTest', 'StatsKWTest', 'StatsLinearCorrelationTest', - 'StatsLinearRegression', 'StatsMultiCorrelationTest', - 'StatsNPMCTest', 'StatsNPNominalSRTest', 'StatsQuantiles', - 'StatsRankCorrelationTest', 'StatsResample', 'StatsSample', - 'StatsScheffeTest', 'StatsSignTest', 'StatsSRTest', 'StatsTTest', - 'StatsTukeyTest', 'StatsVariancesTest', 'StatsWatsonUSquaredTest', - 'StatsWatsonWilliamsTest', 'StatsWheelerWatsonTest', - 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest', 'String', - 'StructGet', 'StructPut', 'TabControl', 'Tag', 'TextBox', 'Tile', - 'TileWindows', 'TitleBox', 'ToCommandLine', 'ToolsGrid', - 'Triangulate3d', 'Unwrap', 'ValDisplay', 'Variable', 'WaveMeanStdv', - 'WaveStats', 'WaveTransform', 'wfprintf', 'WignerTransform', - 'WindowFunction', + 'StatsLinearRegression', 'StatsMultiCorrelationTest', 'StatsNPMCTest', + 'StatsNPNominalSRTest', 'StatsQuantiles', 'StatsRankCorrelationTest', + 'StatsResample', 'StatsSample', 'StatsScheffeTest', 'StatsShapiroWilkTest', + 'StatsSignTest', 'StatsSRTest', 'StatsTTest', 'StatsTukeyTest', + 'StatsVariancesTest', 'StatsWatsonUSquaredTest', 'StatsWatsonWilliamsTest', + 'StatsWheelerWatsonTest', 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest', + 'String', 'StructGet', 'StructPut', 'SumDimension', 'SumSeries', 'TabControl', + 'Tag', 'TextBox', 'ThreadGroupPutDF', 'ThreadStart', 'Tile', 'TileWindows', + 'TitleBox', 'ToCommandLine', 'ToolsGrid', 'Triangulate3d', 'Unwrap', 'URLRequest', + 'ValDisplay', 'Variable', 'VDTClosePort2', 'VDTGetPortList2', 'VDTGetStatus2', + 'VDTOpenPort2', 'VDTOperationsPort2', 'VDTReadBinaryWave2', 'VDTReadBinary2', + 'VDTReadHexWave2', 'VDTReadHex2', 'VDTReadWave2', 'VDTRead2', 'VDTTerminalPort2', + 'VDTWriteBinaryWave2', 'VDTWriteBinary2', 'VDTWriteHexWave2', 'VDTWriteHex2', + 'VDTWriteWave2', 'VDTWrite2', 'VDT2', 'WaveMeanStdv', 'WaveStats', + 'WaveTransform', 'wfprintf', 'WignerTransform', 'WindowFunction', 'XLLoadWave' ) functions = ( - 'abs', 'acos', 'acosh', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD', 'alog', - 'area', 'areaXY', 'asin', 'asinh', 'atan', 'atan2', 'atanh', - 'AxisValFromPixel', 'Besseli', 'Besselj', 'Besselk', 'Bessely', 'bessi', - 'bessj', 'bessk', 'bessy', 'beta', 'betai', 'BinarySearch', + 'abs', 'acos', 'acosh', 'AddListItem', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD', + 'alog', 'AnnotationInfo', 'AnnotationList', 'area', 'areaXY', 'asin', 'asinh', + 'atan', 'atanh', 'atan2', 'AxisInfo', 'AxisList', 'AxisValFromPixel', 'Besseli', + 'Besselj', 'Besselk', 'Bessely', 'beta', 'betai', 'BinarySearch', 'BinarySearchInterp', 'binomial', 'binomialln', 'binomialNoise', 'cabs', - 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num', 'chebyshev', - 'chebyshevU', 'CheckName', 'cmplx', 'cmpstr', 'conj', 'ContourZ', 'cos', - 'cosh', 'cot', 'CountObjects', 'CountObjectsDFR', 'cpowi', - 'CreationDate', 'csc', 'DataFolderExists', 'DataFolderRefsEqual', - 'DataFolderRefStatus', 'date2secs', 'datetime', 'DateToJulian', - 'Dawson', 'DDEExecute', 'DDEInitiate', 'DDEPokeString', 'DDEPokeWave', - 'DDERequestWave', 'DDEStatus', 'DDETerminate', 'defined', 'deltax', 'digamma', - 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves', 'erf', - 'erfc', 'exists', 'exp', 'expInt', 'expNoise', 'factorial', 'fakedata', - 'faverage', 'faverageXY', 'FindDimLabel', 'FindListItem', 'floor', + 'CaptureHistory', 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num', + 'chebyshev', 'chebyshevU', 'CheckName', 'ChildWindowList', 'CleanupName', 'cmplx', + 'cmpstr', 'conj', 'ContourInfo', 'ContourNameList', 'ContourNameToWaveRef', + 'ContourZ', 'ControlNameList', 'ConvertTextEncoding', 'cos', 'cosh', + 'cosIntegral', 'cot', 'coth', 'CountObjects', 'CountObjectsDFR', 'cpowi', + 'CreationDate', 'csc', 'csch', 'CsrInfo', 'CsrWave', 'CsrWaveRef', 'CsrXWave', + 'CsrXWaveRef', 'CTabList', 'DataFolderDir', 'DataFolderExists', + 'DataFolderRefsEqual', 'DataFolderRefStatus', 'date', 'datetime', 'DateToJulian', + 'date2secs', 'Dawson', 'DDERequestString', 'defined', 'deltax', 'digamma', + 'dilogarithm', 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves', + 'erf', 'erfc', 'erfcw', 'exists', 'exp', 'ExpConvExp', 'ExpConvExpFit', + 'ExpConvExpFitBL', 'ExpConvExpFit1Shape', 'ExpConvExpFit1ShapeBL', 'ExpGauss', + 'ExpGaussFit', 'ExpGaussFitBL', 'ExpGaussFit1Shape', 'ExpGaussFit1ShapeBL', + 'expInt', 'expIntegralE1', 'expNoise', 'factorial', 'fakedata', 'faverage', + 'faverageXY', 'FetchURL', 'FindDimLabel', 'FindListItem', 'floor', 'FontList', 'FontSizeHeight', 'FontSizeStringWidth', 'FresnelCos', 'FresnelSin', - 'gamma', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss', - 'Gauss1D', 'Gauss2D', 'gcd', 'GetDefaultFontSize', - 'GetDefaultFontStyle', 'GetKeyState', 'GetRTError', 'gnoise', - 'GrepString', 'hcsr', 'hermite', 'hermiteGauss', 'HyperG0F1', - 'HyperG1F1', 'HyperG2F1', 'HyperGNoise', 'HyperGPFQ', 'IgorVersion', - 'ilim', 'imag', 'Inf', 'Integrate1D', 'interp', 'Interp2D', 'Interp3D', - 'inverseERF', 'inverseERFC', 'ItemsInList', 'jlim', 'Laguerre', - 'LaguerreA', 'LaguerreGauss', 'leftx', 'LegendreA', 'limit', 'ln', - 'log', 'logNormalNoise', 'lorentzianNoise', 'magsqr', 'MandelbrotPoint', - 'MarcumQ', 'MatrixDet', 'MatrixDot', 'MatrixRank', 'MatrixTrace', 'max', - 'mean', 'min', 'mod', 'ModDate', 'NaN', 'norm', 'NumberByKey', - 'numpnts', 'numtype', 'NumVarOrDefault', 'NVAR_Exists', 'p2rect', - 'ParamIsDefault', 'pcsr', 'Pi', 'PixelFromAxisVal', 'pnt2x', - 'poissonNoise', 'poly', 'poly2D', 'PolygonArea', 'qcsr', 'r2polar', - 'real', 'rightx', 'round', 'sawtooth', 'ScreenResolution', 'sec', - 'SelectNumber', 'sign', 'sin', 'sinc', 'sinh', 'SphericalBessJ', - 'SphericalBessJD', 'SphericalBessY', 'SphericalBessYD', - 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF', - 'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF', - 'StatsCauchyCDF', 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF', - 'StatsCMSSDCDF', 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF', - 'StatsErlangCDF', 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF', - 'StatsEValuePDF', 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF', - 'StatsFPDF', 'StatsFriedmanCDF', 'StatsGammaCDF', 'StatsGammaPDF', - 'StatsGeometricCDF', 'StatsGeometricPDF', 'StatsHyperGCDF', - 'StatsHyperGPDF', 'StatsInvBetaCDF', 'StatsInvBinomialCDF', - 'StatsInvCauchyCDF', 'StatsInvChiCDF', 'StatsInvCMSSDCDF', - 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF', - 'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF', - 'StatsInvGeometricCDF', 'StatsInvKuiperCDF', 'StatsInvLogisticCDF', - 'StatsInvLogNormalCDF', 'StatsInvMaxwellCDF', 'StatsInvMooreCDF', - 'StatsInvNBinomialCDF', 'StatsInvNCChiCDF', 'StatsInvNCFCDF', - 'StatsInvNormalCDF', 'StatsInvParetoCDF', 'StatsInvPoissonCDF', - 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF', + 'FuncRefInfo', 'FunctionInfo', 'FunctionList', 'FunctionPath', 'gamma', + 'gammaEuler', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss', + 'GaussFit', 'GaussFitBL', 'GaussFit1Width', 'GaussFit1WidthBL', 'Gauss1D', + 'Gauss2D', 'gcd', 'GetBrowserLine', 'GetBrowserSelection', 'GetDataFolder', + 'GetDataFolderDFR', 'GetDefaultFont', 'GetDefaultFontSize', 'GetDefaultFontStyle', + 'GetDimLabel', 'GetEnvironmentVariable', 'GetErrMessage', 'GetFormula', + 'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR', + 'GetKeyState', 'GetRTErrMessage', 'GetRTError', 'GetRTLocation', 'GetRTLocInfo', + 'GetRTStackInfo', 'GetScrapText', 'GetUserData', 'GetWavesDataFolder', + 'GetWavesDataFolderDFR', 'GizmoInfo', 'GizmoScale', 'gnoise', 'GrepList', + 'GrepString', 'GuideInfo', 'GuideNameList', 'Hash', 'hcsr', 'HDF5AttributeInfo', + 'HDF5DatasetInfo', 'HDF5LibraryInfo', 'HDF5TypeInfo', 'hermite', 'hermiteGauss', + 'HyperGNoise', 'HyperGPFQ', 'HyperG0F1', 'HyperG1F1', 'HyperG2F1', 'IgorInfo', + 'IgorVersion', 'imag', 'ImageInfo', 'ImageNameList', 'ImageNameToWaveRef', + 'IndependentModuleList', 'IndexedDir', 'IndexedFile', 'Inf', 'Integrate1D', + 'interp', 'Interp2D', 'Interp3D', 'inverseERF', 'inverseERFC', 'ItemsInList', + 'JacobiCn', 'JacobiSn', 'JulianToDate', 'Laguerre', 'LaguerreA', 'LaguerreGauss', + 'LambertW', 'LayoutInfo', 'leftx', 'LegendreA', 'limit', 'ListMatch', + 'ListToTextWave', 'ListToWaveRefWave', 'ln', 'log', 'logNormalNoise', + 'LorentzianFit', 'LorentzianFitBL', 'LorentzianFit1Width', + 'LorentzianFit1WidthBL', 'lorentzianNoise', 'LowerStr', 'MacroList', 'magsqr', + 'MandelbrotPoint', 'MarcumQ', 'MatrixCondition', 'MatrixDet', 'MatrixDot', + 'MatrixRank', 'MatrixTrace', 'max', 'mean', 'median', 'min', 'mod', 'ModDate', + 'MPFXEMGPeak', 'MPFXExpConvExpPeak', 'MPFXGaussPeak', 'MPFXLorenzianPeak', + 'MPFXVoigtPeak', 'NameOfWave', 'NaN', 'NewFreeDataFolder', 'NewFreeWave', 'norm', + 'NormalizeUnicode', 'note', 'NumberByKey', 'numpnts', 'numtype', + 'NumVarOrDefault', 'num2char', 'num2istr', 'num2str', 'NVAR_Exists', + 'OperationList', 'PadString', 'PanelResolution', 'ParamIsDefault', + 'ParseFilePath', 'PathList', 'pcsr', 'Pi', 'PICTInfo', 'PICTList', + 'PixelFromAxisVal', 'pnt2x', 'poissonNoise', 'poly', 'PolygonArea', 'poly2D', + 'PossiblyQuoteName', 'ProcedureText', 'p2rect', 'qcsr', 'real', 'RemoveByKey', + 'RemoveEnding', 'RemoveFromList', 'RemoveListItem', 'ReplaceNumberByKey', + 'ReplaceString', 'ReplaceStringByKey', 'rightx', 'round', 'r2polar', 'sawtooth', + 'scaleToIndex', 'ScreenResolution', 'sec', 'sech', 'Secs2Date', 'Secs2Time', + 'SelectNumber', 'SelectString', 'SetEnvironmentVariable', 'sign', 'sin', 'sinc', + 'sinh', 'sinIntegral', 'SortList', 'SpecialCharacterInfo', 'SpecialCharacterList', + 'SpecialDirPath', 'SphericalBessJ', 'SphericalBessJD', 'SphericalBessY', + 'SphericalBessYD', 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF', + 'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF', 'StatsCauchyCDF', + 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF', 'StatsCMSSDCDF', + 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF', 'StatsErlangCDF', + 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF', 'StatsEValuePDF', + 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF', 'StatsFPDF', 'StatsFriedmanCDF', + 'StatsGammaCDF', 'StatsGammaPDF', 'StatsGeometricCDF', 'StatsGeometricPDF', + 'StatsGEVCDF', 'StatsGEVPDF', 'StatsHyperGCDF', 'StatsHyperGPDF', + 'StatsInvBetaCDF', 'StatsInvBinomialCDF', 'StatsInvCauchyCDF', 'StatsInvChiCDF', + 'StatsInvCMSSDCDF', 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF', + 'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF', 'StatsInvGeometricCDF', + 'StatsInvKuiperCDF', 'StatsInvLogisticCDF', 'StatsInvLogNormalCDF', + 'StatsInvMaxwellCDF', 'StatsInvMooreCDF', 'StatsInvNBinomialCDF', + 'StatsInvNCChiCDF', 'StatsInvNCFCDF', 'StatsInvNormalCDF', 'StatsInvParetoCDF', + 'StatsInvPoissonCDF', 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF', 'StatsInvRayleighCDF', 'StatsInvRectangularCDF', 'StatsInvSpearmanCDF', 'StatsInvStudentCDF', 'StatsInvTopDownCDF', 'StatsInvTriangularCDF', 'StatsInvUsquaredCDF', 'StatsInvVonMisesCDF', 'StatsInvWeibullCDF', - 'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF', - 'StatsLogNormalCDF', 'StatsLogNormalPDF', 'StatsMaxwellCDF', - 'StatsMaxwellPDF', 'StatsMedian', 'StatsMooreCDF', 'StatsNBinomialCDF', - 'StatsNBinomialPDF', 'StatsNCChiCDF', 'StatsNCChiPDF', 'StatsNCFCDF', - 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF', 'StatsNormalCDF', - 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF', 'StatsPermute', - 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF', - 'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF', - 'StatsRayleighCDF', 'StatsRayleighPDF', 'StatsRectangularCDF', - 'StatsRectangularPDF', 'StatsRunsCDF', 'StatsSpearmanRhoCDF', - 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF', + 'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF', 'StatsLogNormalCDF', + 'StatsLogNormalPDF', 'StatsMaxwellCDF', 'StatsMaxwellPDF', 'StatsMedian', + 'StatsMooreCDF', 'StatsNBinomialCDF', 'StatsNBinomialPDF', 'StatsNCChiCDF', + 'StatsNCChiPDF', 'StatsNCFCDF', 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF', + 'StatsNormalCDF', 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF', + 'StatsPermute', 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF', + 'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF', 'StatsRayleighCDF', + 'StatsRayleighPDF', 'StatsRectangularCDF', 'StatsRectangularPDF', 'StatsRunsCDF', + 'StatsSpearmanRhoCDF', 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF', 'StatsTriangularCDF', 'StatsTriangularPDF', 'StatsTrimmedMean', - 'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise', - 'StatsVonMisesPDF', 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF', - 'StatsWeibullPDF', 'StopMSTimer', 'str2num', 'stringCRC', 'stringmatch', - 'strlen', 'strsearch', 'StudentA', 'StudentT', 'sum', 'SVAR_Exists', - 'TagVal', 'tan', 'tanh', 'ThreadGroupCreate', 'ThreadGroupRelease', - 'ThreadGroupWait', 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks', - 'trunc', 'Variance', 'vcsr', 'WaveCRC', 'WaveDims', 'WaveExists', - 'WaveMax', 'WaveMin', 'WaveRefsEqual', 'WaveType', 'WhichListItem', - 'WinType', 'WNoise', 'x2pnt', 'xcsr', 'zcsr', 'ZernikeR', - ) - functions += ( - 'AddListItem', 'AnnotationInfo', 'AnnotationList', 'AxisInfo', - 'AxisList', 'CaptureHistory', 'ChildWindowList', 'CleanupName', - 'ContourInfo', 'ContourNameList', 'ControlNameList', 'CsrInfo', - 'CsrWave', 'CsrXWave', 'CTabList', 'DataFolderDir', 'date', - 'DDERequestString', 'FontList', 'FuncRefInfo', 'FunctionInfo', - 'FunctionList', 'FunctionPath', 'GetDataFolder', 'GetDefaultFont', - 'GetDimLabel', 'GetErrMessage', 'GetFormula', - 'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR', - 'GetRTErrMessage', 'GetRTStackInfo', 'GetScrapText', 'GetUserData', - 'GetWavesDataFolder', 'GrepList', 'GuideInfo', 'GuideNameList', 'Hash', - 'IgorInfo', 'ImageInfo', 'ImageNameList', 'IndexedDir', 'IndexedFile', - 'JulianToDate', 'LayoutInfo', 'ListMatch', 'LowerStr', 'MacroList', - 'NameOfWave', 'note', 'num2char', 'num2istr', 'num2str', - 'OperationList', 'PadString', 'ParseFilePath', 'PathList', 'PICTInfo', - 'PICTList', 'PossiblyQuoteName', 'ProcedureText', 'RemoveByKey', - 'RemoveEnding', 'RemoveFromList', 'RemoveListItem', - 'ReplaceNumberByKey', 'ReplaceString', 'ReplaceStringByKey', - 'Secs2Date', 'Secs2Time', 'SelectString', 'SortList', - 'SpecialCharacterInfo', 'SpecialCharacterList', 'SpecialDirPath', - 'StringByKey', 'StringFromList', 'StringList', 'StrVarOrDefault', - 'TableInfo', 'TextFile', 'ThreadGroupGetDF', 'time', 'TraceFromPixel', - 'TraceInfo', 'TraceNameList', 'UniqueName', 'UnPadString', 'UpperStr', - 'VariableList', 'WaveInfo', 'WaveList', 'WaveName', 'WaveUnits', - 'WinList', 'WinName', 'WinRecreation', 'XWaveName', - 'ContourNameToWaveRef', 'CsrWaveRef', 'CsrXWaveRef', - 'ImageNameToWaveRef', 'NewFreeWave', 'TagWaveRef', 'TraceNameToWaveRef', - 'WaveRefIndexed', 'XWaveRefFromTrace', 'GetDataFolderDFR', - 'GetWavesDataFolderDFR', 'NewFreeDataFolder', 'ThreadGroupGetDFR', + 'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise', 'StatsVonMisesPDF', + 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF', 'StatsWeibullPDF', + 'StopMSTimer', 'StringByKey', 'stringCRC', 'StringFromList', 'StringList', + 'stringmatch', 'strlen', 'strsearch', 'StrVarOrDefault', 'str2num', 'StudentA', + 'StudentT', 'sum', 'SVAR_Exists', 'TableInfo', 'TagVal', 'TagWaveRef', 'tan', + 'tanh', 'TextEncodingCode', 'TextEncodingName', 'TextFile', 'ThreadGroupCreate', + 'ThreadGroupGetDF', 'ThreadGroupGetDFR', 'ThreadGroupRelease', 'ThreadGroupWait', + 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks', 'time', 'TraceFromPixel', + 'TraceInfo', 'TraceNameList', 'TraceNameToWaveRef', 'trunc', 'UniqueName', + 'UnPadString', 'UnsetEnvironmentVariable', 'UpperStr', 'URLDecode', 'URLEncode', + 'VariableList', 'Variance', 'vcsr', 'Voigt', 'VoigtFit', 'VoigtFitBL', + 'VoigtFit1Shape', 'VoigtFit1ShapeBL', 'VoigtFit1Shape1Width', + 'VoigtFit1Shape1WidthBL', 'VoigtFunc', 'WaveCRC', 'WaveDims', 'WaveExists', + 'WaveInfo', 'WaveList', 'WaveMax', 'WaveMin', 'WaveName', 'WaveRefIndexed', + 'WaveRefIndexedDFR', 'WaveRefsEqual', 'WaveRefWaveToList', 'WaveTextEncoding', + 'WaveType', 'WaveUnits', 'WhichListItem', 'WinList', 'WinName', 'WinRecreation', + 'WinType', 'WMFindWholeWord', 'WNoise', 'xcsr', 'XWaveName', 'XWaveRefFromTrace', + 'x2pnt', 'zcsr', 'ZernikeR', 'zeta' ) tokens = { @@ -272,7 +280,7 @@ class IgorLexer(RegexLexer): # Built-in functions. (words(functions, prefix=r'\b', suffix=r'\b'), Name.Function), # Compiler directives. - (r'^#(include|pragma|define|ifdef|ifndef|endif)', + (r'^#(include|pragma|define|undef|ifdef|ifndef|if|elif|else|endif)', Name.Decorator), (r'[^a-z"/]+$', Text), (r'.', Text), diff --git a/pygments/lexers/perl.py b/pygments/lexers/perl.py index b78963d0..8df3c810 100644 --- a/pygments/lexers/perl.py +++ b/pygments/lexers/perl.py @@ -109,7 +109,8 @@ class PerlLexer(RegexLexer): 'utime', 'values', 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write'), suffix=r'\b'), Name.Builtin), (r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo), - (r'<<([\'"]?)([a-zA-Z_]\w*)\1;?\n.*?\n\2\n', String), + (r'(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)', + bygroups(String, String, String.Delimiter, String, String.Delimiter, Text)), (r'__END__', Comment.Preproc, 'end-part'), (r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global), (r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global), diff --git a/pygments/lexers/php.py b/pygments/lexers/php.py index 75b662cb..2421738f 100644 --- a/pygments/lexers/php.py +++ b/pygments/lexers/php.py @@ -11,7 +11,8 @@ import re -from pygments.lexer import RegexLexer, include, bygroups, default, using, this +from pygments.lexer import RegexLexer, include, bygroups, default, using, \ + this, words from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Other from pygments.util import get_bool_opt, get_list_opt, iteritems @@ -137,7 +138,9 @@ class PhpLexer(RegexLexer): ], 'php': [ (r'\?>', Comment.Preproc, '#pop'), - (r'<<<([\'"]?)(' + _ident_inner + r')\1\n.*?\n\s*\2;?\n', String), + (r'(<<<)([\'"]?)(' + _ident_inner + r')(\2\n.*?\n\s*)(\3)(;?)(\n)', + bygroups(String, String, String.Delimiter, String, String.Delimiter, + Punctuation, Text)), (r'\s+', Text), (r'#.*?\n', Comment.Single), (r'//.*?\n', Comment.Single), @@ -162,13 +165,14 @@ class PhpLexer(RegexLexer): r'FALSE|print|for|require|continue|foreach|require_once|' r'declare|return|default|static|do|switch|die|stdClass|' r'echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|' - r'virtual|endfor|include_once|while|endforeach|global|__FILE__|' - r'endif|list|__LINE__|endswitch|new|__sleep|endwhile|not|' - r'array|__wakeup|E_ALL|NULL|final|php_user_filter|interface|' + r'virtual|endfor|include_once|while|endforeach|global|' + r'endif|list|endswitch|new|endwhile|not|' + r'array|E_ALL|NULL|final|php_user_filter|interface|' r'implements|public|private|protected|abstract|clone|try|' r'catch|throw|this|use|namespace|trait|yield|' r'finally)\b', Keyword), (r'(true|false|null)\b', Keyword.Constant), + include('magicconstants'), (r'\$\{\$+' + _ident_inner + '\}', Name.Variable), (r'\$+' + _ident_inner, Name.Variable), (_ident_inner, Name.Other), @@ -182,11 +186,29 @@ class PhpLexer(RegexLexer): (r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick), (r'"', String.Double, 'string'), ], + 'magicfuncs': [ + # source: http://php.net/manual/en/language.oop5.magic.php + (words(( + '__construct', '__destruct', '__call', '__callStatic', '__get', '__set', + '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke', + '__set_state', '__clone', '__debugInfo',), suffix=r'\b'), + Name.Function.Magic), + ], + 'magicconstants': [ + # source: http://php.net/manual/en/language.constants.predefined.php + (words(( + '__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__', + '__TRAIT__', '__METHOD__', '__NAMESPACE__',), + suffix=r'\b'), + Name.Constant), + ], 'classname': [ (_ident_inner, Name.Class, '#pop') ], 'functionname': [ - (_ident_inner, Name.Function, '#pop') + include('magicfuncs'), + (_ident_inner, Name.Function, '#pop'), + default('#pop') ], 'string': [ (r'"', String.Double, '#pop'), diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py index 9433f7fd..f483071b 100644 --- a/pygments/lexers/python.py +++ b/pygments/lexers/python.py @@ -51,8 +51,8 @@ class PythonLexer(RegexLexer): tokens = { 'root': [ (r'\n', Text), - (r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)), - (r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)), + (r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")', bygroups(Text, String.Affix, String.Doc)), + (r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')", bygroups(Text, String.Affix, String.Doc)), (r'[^\S\n]+', Text), (r'\A#!.+$', Comment.Hashbang), (r'#.*$', Comment.Single), @@ -69,15 +69,17 @@ class PythonLexer(RegexLexer): (r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text), 'import'), include('builtins'), + include('magicfuncs'), + include('magicvars'), include('backtick'), - ('(?:[rR]|[uU][rR]|[rR][uU])"""', String.Double, 'tdqs'), - ("(?:[rR]|[uU][rR]|[rR][uU])'''", String.Single, 'tsqs'), - ('(?:[rR]|[uU][rR]|[rR][uU])"', String.Double, 'dqs'), - ("(?:[rR]|[uU][rR]|[rR][uU])'", String.Single, 'sqs'), - ('[uU]?"""', String.Double, combined('stringescape', 'tdqs')), - ("[uU]?'''", String.Single, combined('stringescape', 'tsqs')), - ('[uU]?"', String.Double, combined('stringescape', 'dqs')), - ("[uU]?'", String.Single, combined('stringescape', 'sqs')), + ('([rR]|[uUbB][rR]|[rR][uUbB])(""")', bygroups(String.Affix, String.Double), 'tdqs'), + ("([rR]|[uUbB][rR]|[rR][uUbB])(''')", bygroups(String.Affix, String.Single), 'tsqs'), + ('([rR]|[uUbB][rR]|[rR][uUbB])(")', bygroups(String.Affix, String.Double), 'dqs'), + ("([rR]|[uUbB][rR]|[rR][uUbB])(')", bygroups(String.Affix, String.Single), 'sqs'), + ('([uUbB]?)(""")', bygroups(String.Affix, String.Double), combined('stringescape', 'tdqs')), + ("([uUbB]?)(''')", bygroups(String.Affix, String.Single), combined('stringescape', 'tsqs')), + ('([uUbB]?)(")', bygroups(String.Affix, String.Double), combined('stringescape', 'dqs')), + ("([uUbB]?)(')", bygroups(String.Affix, String.Single), combined('stringescape', 'sqs')), include('name'), include('numbers'), ], @@ -123,6 +125,37 @@ class PythonLexer(RegexLexer): 'ZeroDivisionError'), prefix=r'(?<!\.)', suffix=r'\b'), Name.Exception), ], + 'magicfuncs': [ + (words(( + '__abs__', '__add__', '__and__', '__call__', '__cmp__', '__coerce__', + '__complex__', '__contains__', '__del__', '__delattr__', '__delete__', + '__delitem__', '__delslice__', '__div__', '__divmod__', '__enter__', + '__eq__', '__exit__', '__float__', '__floordiv__', '__ge__', '__get__', + '__getattr__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', + '__hash__', '__hex__', '__iadd__', '__iand__', '__idiv__', '__ifloordiv__', + '__ilshift__', '__imod__', '__imul__', '__index__', '__init__', + '__instancecheck__', '__int__', '__invert__', '__iop__', '__ior__', + '__ipow__', '__irshift__', '__isub__', '__iter__', '__itruediv__', + '__ixor__', '__le__', '__len__', '__long__', '__lshift__', '__lt__', + '__missing__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', + '__nonzero__', '__oct__', '__op__', '__or__', '__pos__', '__pow__', + '__radd__', '__rand__', '__rcmp__', '__rdiv__', '__rdivmod__', '__repr__', + '__reversed__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', + '__rop__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', + '__rtruediv__', '__rxor__', '__set__', '__setattr__', '__setitem__', + '__setslice__', '__str__', '__sub__', '__subclasscheck__', '__truediv__', + '__unicode__', '__xor__'), suffix=r'\b'), + Name.Function.Magic), + ], + 'magicvars': [ + (words(( + '__bases__', '__class__', '__closure__', '__code__', '__defaults__', + '__dict__', '__doc__', '__file__', '__func__', '__globals__', + '__metaclass__', '__module__', '__mro__', '__name__', '__self__', + '__slots__', '__weakref__'), + suffix=r'\b'), + Name.Variable.Magic), + ], 'numbers': [ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float), (r'\d+[eE][+-]?[0-9]+j?', Number.Float), @@ -140,7 +173,9 @@ class PythonLexer(RegexLexer): ('[a-zA-Z_]\w*', Name), ], 'funcname': [ - ('[a-zA-Z_]\w*', Name.Function, '#pop') + include('magicfuncs'), + ('[a-zA-Z_]\w*', Name.Function, '#pop'), + default('#pop'), ], 'classname': [ ('[a-zA-Z_]\w*', Name.Class, '#pop') @@ -283,6 +318,38 @@ class Python3Lexer(RegexLexer): prefix=r'(?<!\.)', suffix=r'\b'), Name.Exception), ] + tokens['magicfuncs'] = [ + (words(( + '__abs__', '__add__', '__aenter__', '__aexit__', '__aiter__', '__and__', + '__anext__', '__await__', '__bool__', '__bytes__', '__call__', + '__complex__', '__contains__', '__del__', '__delattr__', '__delete__', + '__delitem__', '__dir__', '__divmod__', '__enter__', '__eq__', '__exit__', + '__float__', '__floordiv__', '__format__', '__ge__', '__get__', + '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', + '__iadd__', '__iand__', '__ifloordiv__', '__ilshift__', '__imatmul__', + '__imod__', '__import__', '__imul__', '__index__', '__init__', + '__instancecheck__', '__int__', '__invert__', '__ior__', '__ipow__', + '__irshift__', '__isub__', '__iter__', '__itruediv__', '__ixor__', + '__le__', '__len__', '__length_hint__', '__lshift__', '__lt__', + '__matmul__', '__missing__', '__mod__', '__mul__', '__ne__', '__neg__', + '__new__', '__next__', '__or__', '__pos__', '__pow__', '__prepare__', + '__radd__', '__rand__', '__rdivmod__', '__repr__', '__reversed__', + '__rfloordiv__', '__rlshift__', '__rmatmul__', '__rmod__', '__rmul__', + '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', + '__rsub__', '__rtruediv__', '__rxor__', '__set__', '__setattr__', + '__setitem__', '__str__', '__sub__', '__subclasscheck__', '__truediv__', + '__xor__'), suffix=r'\b'), + Name.Function.Magic), + ] + tokens['magicvars'] = [ + (words(( + '__annotations__', '__bases__', '__class__', '__closure__', '__code__', + '__defaults__', '__dict__', '__doc__', '__file__', '__func__', + '__globals__', '__kwdefaults__', '__module__', '__mro__', '__name__', + '__objclass__', '__qualname__', '__self__', '__slots__', '__weakref__'), + suffix=r'\b'), + Name.Variable.Magic), + ] tokens['numbers'] = [ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), (r'0[oO][0-7]+', Number.Oct), diff --git a/pygments/lexers/ruby.py b/pygments/lexers/ruby.py index e81d6ecf..f16416d3 100644 --- a/pygments/lexers/ruby.py +++ b/pygments/lexers/ruby.py @@ -47,9 +47,9 @@ class RubyLexer(ExtendedRegexLexer): start = match.start(1) yield start, Operator, match.group(1) # <<-? - yield match.start(2), String.Heredoc, match.group(2) # quote ", ', ` - yield match.start(3), Name.Constant, match.group(3) # heredoc name - yield match.start(4), String.Heredoc, match.group(4) # quote again + yield match.start(2), String.Heredoc, match.group(2) # quote ", ', ` + yield match.start(3), String.Delimiter, match.group(3) # heredoc name + yield match.start(4), String.Heredoc, match.group(4) # quote again heredocstack = ctx.__dict__.setdefault('heredocstack', []) outermost = not bool(heredocstack) @@ -74,7 +74,7 @@ class RubyLexer(ExtendedRegexLexer): if check == hdname: for amatch in lines: yield amatch.start(), String.Heredoc, amatch.group() - yield match.start(), Name.Constant, match.group() + yield match.start(), String.Delimiter, match.group() ctx.pos = match.end() break else: diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py index a7736f75..7c06226b 100644 --- a/pygments/lexers/sql.py +++ b/pygments/lexers/sql.py @@ -57,11 +57,14 @@ line_re = re.compile('.*?\n') language_re = re.compile(r"\s+LANGUAGE\s+'?(\w+)'?", re.IGNORECASE) +do_re = re.compile(r'\bDO\b', re.IGNORECASE) + def language_callback(lexer, match): """Parse the content of a $-string using a lexer - The lexer is chosen looking for a nearby LANGUAGE. + The lexer is chosen looking for a nearby LANGUAGE or assumed as + plpgsql if inside a DO statement and no LANGUAGE has been found. """ l = None m = language_re.match(lexer.text[match.end():match.end()+100]) @@ -72,15 +75,26 @@ def language_callback(lexer, match): lexer.text[max(0, match.start()-100):match.start()])) if m: l = lexer._get_lexer(m[-1].group(1)) - + else: + m = list(do_re.finditer( + lexer.text[max(0, match.start()-25):match.start()])) + if m: + l = lexer._get_lexer('plpgsql') + + # 1 = $, 2 = delimiter, 3 = $ + yield (match.start(1), String, match.group(1)) + yield (match.start(2), String.Delimiter, match.group(2)) + yield (match.start(3), String, match.group(3)) + # 4 = string contents if l: - yield (match.start(1), String, match.group(1)) - for x in l.get_tokens_unprocessed(match.group(2)): + for x in l.get_tokens_unprocessed(match.group(4)): yield x - yield (match.start(3), String, match.group(3)) - else: - yield (match.start(), String, match.group()) + yield (match.start(4), String, match.group(4)) + # 5 = $, 6 = delimiter, 7 = $ + yield (match.start(5), String, match.group(5)) + yield (match.start(6), String.Delimiter, match.group(6)) + yield (match.start(7), String, match.group(7)) class PostgresBase(object): @@ -148,9 +162,10 @@ class PostgresLexer(PostgresBase, RegexLexer): (r'\$\d+', Name.Variable), (r'([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?', Number.Float), (r'[0-9]+', Number.Integer), - (r"(E|U&)?'", String.Single, 'string'), - (r'(U&)?"', String.Name, 'quoted-ident'), # quoted identifier - (r'(?s)(\$[^$]*\$)(.*?)(\1)', language_callback), + (r"((?:E|U&)?)(')", bygroups(String.Affix, String.Single), 'string'), + # quoted identifier + (r'((?:U&)?)(")', bygroups(String.Affix, String.Name), 'quoted-ident'), + (r'(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)', language_callback), (r'[a-z_]\w*', Name), # psql variable in SQL diff --git a/pygments/lexers/typoscript.py b/pygments/lexers/typoscript.py new file mode 100644 index 00000000..25bfef9c --- /dev/null +++ b/pygments/lexers/typoscript.py @@ -0,0 +1,225 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.typoscript + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for TypoScript + + `TypoScriptLexer` + A TypoScript lexer. + + `TypoScriptCssDataLexer` + Lexer that highlights markers, constants and registers within css. + + `TypoScriptHtmlDataLexer` + Lexer that highlights markers, constants and registers within html tags. + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using +from pygments.token import Keyword, Text, Comment, Name, String, Number, \ + Operator, Punctuation +from pygments.lexer import DelegatingLexer +from pygments.lexers.web import HtmlLexer, CssLexer + +__all__ = ['TypoScriptLexer', 'TypoScriptCssDataLexer', 'TypoScriptHtmlDataLexer'] + + +class TypoScriptCssDataLexer(RegexLexer): + """ + Lexer that highlights markers, constants and registers within css blocks. + + .. versionadded:: 2.2 + """ + + name = 'TypoScriptCssData' + aliases = ['typoscriptcssdata'] + + tokens = { + 'root': [ + # marker: ###MARK### + (r'(.*)(###\w+###)(.*)', bygroups(String, Name.Constant, String)), + # constant: {$some.constant} + (r'(\{)(\$)((?:[\w\-_]+\.)*)([\w\-_]+)(\})', + bygroups(String.Symbol, Operator, Name.Constant, + Name.Constant, String.Symbol)), # constant + # constant: {register:somevalue} + (r'(.*)(\{)([\w\-_]+)(\s*:\s*)([\w\-_]+)(\})(.*)', + bygroups(String, String.Symbol, Name.Constant, Operator, + Name.Constant, String.Symbol, String)), # constant + # whitespace + (r'\s+', Text), + # comments + (r'/\*(?:(?!\*/).)*\*/', Comment), + (r'(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)', + Comment), + # other + (r'[<>,:=\.\*%+\|]', String), + (r'[\w"_\-!\/&;\(\)\{\}]+', String), + ] + } + + +class TypoScriptHtmlDataLexer(RegexLexer): + """ + Lexer that highlights markers, constants and registers within html tags. + + .. versionadded:: 2.2 + """ + + name = 'TypoScriptHtmlData' + aliases = ['typoscripthtmldata'] + + tokens = { + 'root': [ + # INCLUDE_TYPOSCRIPT + (r'(INCLUDE_TYPOSCRIPT)', Name.Class), + # Language label or extension resource FILE:... or LLL:... or EXT:... + (r'(EXT|FILE|LLL):[^\}\n"]*', String), + # marker: ###MARK### + (r'(.*)(###\w+###)(.*)', bygroups(String, Name.Constant, String)), + # constant: {$some.constant} + (r'(\{)(\$)((?:[\w\-_]+\.)*)([\w\-_]+)(\})', + bygroups(String.Symbol, Operator, Name.Constant, + Name.Constant, String.Symbol)), # constant + # constant: {register:somevalue} + (r'(.*)(\{)([\w\-_]+)(\s*:\s*)([\w\-_]+)(\})(.*)', + bygroups(String, String.Symbol, Name.Constant, Operator, + Name.Constant, String.Symbol, String)), # constant + # whitespace + (r'\s+', Text), + # other + (r'[<>,:=\.\*%+\|]', String), + (r'[\w"_\-!\/&;\(\)\{\}#]+', String), + ] + } + + +class TypoScriptLexer(RegexLexer): + """ + Lexer for TypoScript code. + + http://docs.typo3.org/typo3cms/TyposcriptReference/ + + .. versionadded:: 2.2 + """ + + name = 'TypoScript' + aliases = ['typoscript'] + filenames = ['*.ts', '*.txt'] + mimetypes = ['text/x-typoscript'] + + flags = re.DOTALL | re.MULTILINE + + tokens = { + 'root': [ + include('comment'), + include('constant'), + include('html'), + include('label'), + include('whitespace'), + include('keywords'), + include('punctuation'), + include('operator'), + include('structure'), + include('literal'), + include('other'), + ], + 'keywords': [ + # Conditions + (r'(\[)(?i)(browser|compatVersion|dayofmonth|dayofweek|dayofyear|' + r'device|ELSE|END|GLOBAL|globalString|globalVar|hostname|hour|IP|' + r'language|loginUser|loginuser|minute|month|page|PIDinRootline|' + r'PIDupinRootline|system|treeLevel|useragent|userFunc|usergroup|' + r'version)([^\]]*)(\])', + bygroups(String.Symbol, Name.Constant, Text, String.Symbol)), + # Functions + (r'(?=[\w\-_])(HTMLparser|HTMLparser_tags|addParams|cache|encapsLines|' + r'filelink|if|imageLinkWrap|imgResource|makelinks|numRows|numberFormat|' + r'parseFunc|replacement|round|select|split|stdWrap|strPad|tableStyle|' + r'tags|textStyle|typolink)(?![\w\-_])', Name.Function), + # Toplevel objects and _* + (r'(?:(=?\s*<?\s+|^\s*))(cObj|field|config|content|constants|FEData|' + r'file|frameset|includeLibs|lib|page|plugin|register|resources|sitemap|' + r'sitetitle|styles|temp|tt_[^:\.\n\s]*|types|xmlnews|INCLUDE_TYPOSCRIPT|' + r'_CSS_DEFAULT_STYLE|_DEFAULT_PI_VARS|_LOCAL_LANG)(?![\w\-_])', + bygroups(Operator, Name.Builtin)), + # Content objects + (r'(?=[\w\-_])(CASE|CLEARGIF|COA|COA_INT|COBJ_ARRAY|COLUMNS|CONTENT|' + r'CTABLE|EDITPANEL|FILE|FILES|FLUIDTEMPLATE|FORM|HMENU|HRULER|HTML|' + r'IMAGE|IMGTEXT|IMG_RESOURCE|LOAD_REGISTER|MEDIA|MULTIMEDIA|OTABLE|' + r'PAGE|QTOBJECT|RECORDS|RESTORE_REGISTER|SEARCHRESULT|SVG|SWFOBJECT|' + r'TEMPLATE|TEXT|USER|USER_INT)(?![\w\-_])', Name.Class), + # Menu states + (r'(?=[\w\-_])(ACT|ACTIFSUB|ACTIFSUBRO|ACTRO|CUR|CURIFSUB|CURIFSUBRO|' + r'CURRO|IFSUB|IFSUBRO|NO|SPC|USERDEF1|USERDEF1RO|USERDEF2|USERDEF2RO|' + r'USR|USRRO)', Name.Class), + # Menu objects + (r'(?=[\w\-_])(GMENU|GMENU_FOLDOUT|GMENU_LAYERS|IMGMENU|IMGMENUITEM|' + r'JSMENU|JSMENUITEM|TMENU|TMENUITEM|TMENU_LAYERS)', Name.Class), + # PHP objects + (r'(?=[\w\-_])(PHP_SCRIPT(_EXT|_INT)?)', Name.Class), + (r'(?=[\w\-_])(userFunc)(?![\w\-_])', Name.Function), + ], + 'whitespace': [ + (r'\s+', Text), + ], + 'html':[ + (r'<[^\s][^\n>]*>', using(TypoScriptHtmlDataLexer)), + (r'&[^;\n]*;', String), + (r'(_CSS_DEFAULT_STYLE)(\s*)(\()(?s)(.*(?=\n\)))', + bygroups(Name.Class, Text, String.Symbol, using(TypoScriptCssDataLexer))), + ], + 'literal': [ + (r'0x[0-9A-Fa-f]+t?',Number.Hex), + # (r'[0-9]*\.[0-9]+([eE][0-9]+)?[fd]?\s*(?:[^=])', Number.Float), + (r'[0-9]+', Number.Integer), + (r'(###\w+###)', Name.Constant), + ], + 'label': [ + # Language label or extension resource FILE:... or LLL:... or EXT:... + (r'(EXT|FILE|LLL):[^\}\n"]*', String), + # Path to a resource + (r'(?![^\w\-_])([\w\-_]+(?:/[\w\-_]+)+/?)([^\s]*\n)', + bygroups(String, String)), + ], + 'punctuation': [ + (r'[,\.]', Punctuation), + ], + 'operator': [ + (r'[<>,:=\.\*%+\|]', Operator), + ], + 'structure': [ + # Brackets and braces + (r'[\{\}\(\)\[\]\\\\]', String.Symbol), + ], + 'constant': [ + # Constant: {$some.constant} + (r'(\{)(\$)((?:[\w\-_]+\.)*)([\w\-_]+)(\})', + bygroups(String.Symbol, Operator, Name.Constant, + Name.Constant, String.Symbol)), # constant + # Constant: {register:somevalue} + (r'(\{)([\w\-_]+)(\s*:\s*)([\w\-_]+)(\})', + bygroups(String.Symbol, Name.Constant, Operator, + Name.Constant, String.Symbol)), # constant + # Hex color: #ff0077 + (r'(#[a-fA-F0-9]{6}\b|#[a-fA-F0-9]{3}\b)', String.Char) + ], + 'comment': [ + (r'(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)', + Comment), + (r'/\*(?:(?!\*/).)*\*/', Comment), + (r'(\s*#\s*\n)', Comment), + ], + 'other': [ + (r'[\w"\-_!\/&;]+', Text), + ], + } + + def analyse_text(text): + if '<INCLUDE_TYPOSCRIPT:' in text: + return 1.0 diff --git a/pygments/lexers/varnish.py b/pygments/lexers/varnish.py new file mode 100644 index 00000000..90d8d292 --- /dev/null +++ b/pygments/lexers/varnish.py @@ -0,0 +1,186 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.varnish + ~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Varnish configuration + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, bygroups, using, this, \ + inherit, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Literal + +__all__ = ['VCLLexer', 'VCLSnippetLexer'] + + +class VCLLexer(RegexLexer): + """ + For Varnish Configuration Language (VCL). + + .. versionadded:: 2.2 + """ + name = 'VCL' + aliases = ['vcl'] + filenames = ['*.vcl'] + mimetypes = ['text/x-vclsrc'] + + def analyse_text(text): + # If the very first line is 'vcl 4.0;' it's pretty much guaranteed + # that this is VCL + if text.startswith('vcl 4.0;'): + return 1.0 + # Skip over comments and blank lines + # This is accurate enough that returning 0.9 is reasonable. + # Almost no VCL files start without some comments. + elif '\nvcl 4\.0;' in text[:1000]: + return 0.9 + + tokens = { + 'probe': [ + include('whitespace'), + include('comments'), + (r'(\.\w+)(\s*=\s*)([^;]*)(;)', + bygroups(Name.Attribute, Operator, using(this), Punctuation)), + (r'}', Punctuation, '#pop'), + ], + 'acl': [ + include('whitespace'), + include('comments'), + (r'[!/]+', Operator), + (r';', Punctuation), + (r'\d+', Number), + (r'}', Punctuation, '#pop'), + ], + 'backend': [ + include('whitespace'), + (r'(\.probe)(\s*=\s*)(\w+)(;)', + bygroups(Name.Attribute, Operator, Name.Variable.Global, Punctuation)), + (r'(\.probe)(\s*=\s*)({)', + bygroups(Name.Attribute, Operator, Punctuation), 'probe'), + (r'(\.\w+\b)(\s*=\s*)([^;]*)(\s*;)', + bygroups(Name.Attribute, Operator, using(this), Punctuation)), + (r'{', Punctuation, '#push'), + (r'}', Punctuation, '#pop'), + ], + 'statements': [ + (r'(\d\.)?\d+[sdwhmy]', Literal.Date), + (r'(\d\.)?\d+ms', Literal.Date), + (r'(vcl_pass|vcl_hash|vcl_hit|vcl_init|vcl_backend_fetch|vcl_pipe|' + r'vcl_backend_response|vcl_synth|vcl_deliver|vcl_backend_error|' + r'vcl_fini|vcl_recv|vcl_purge|vcl_miss)\b', Name.Function), + (r'(pipe|retry|hash|synth|deliver|purge|abandon|lookup|pass|fail|ok|' + r'miss|fetch|restart)\b', Name.Constant), + (r'(beresp|obj|resp|req|req_top|bereq)\.http\.[a-zA-Z_-]+\b', Name.Variable), + (words(( + 'obj.status', 'req.hash_always_miss', 'beresp.backend', 'req.esi_level', + 'req.can_gzip', 'beresp.ttl', 'obj.uncacheable', 'req.ttl', 'obj.hits', + 'client.identity', 'req.hash_ignore_busy', 'obj.reason', 'req.xid', + 'req_top.proto', 'beresp.age', 'obj.proto', 'obj.age', 'local.ip', + 'beresp.uncacheable', 'req.method', 'beresp.backend.ip', 'now', + 'obj.grace', 'req.restarts', 'beresp.keep', 'req.proto', 'resp.proto', + 'bereq.xid', 'bereq.between_bytes_timeout', 'req.esi', + 'bereq.first_byte_timeout', 'bereq.method', 'bereq.connect_timeout', + 'beresp.do_gzip', 'resp.status', 'beresp.do_gunzip', + 'beresp.storage_hint', 'resp.is_streaming', 'beresp.do_stream', + 'req_top.method', 'bereq.backend', 'beresp.backend.name', 'beresp.status', + 'req.url', 'obj.keep', 'obj.ttl', 'beresp.reason', 'bereq.retries', + 'resp.reason', 'bereq.url', 'beresp.do_esi', 'beresp.proto', 'client.ip', + 'bereq.proto', 'server.hostname', 'remote.ip', 'req.backend_hint', + 'server.identity', 'req_top.url', 'beresp.grace', 'beresp.was_304', + 'server.ip', 'bereq.uncacheable', 'now'), suffix=r'(\b|$)'), + Name.Variable), + (r'[!%&+*-,/<.}{>=|~]+', Operator), + (r'[();]', Punctuation), + + (r'[,]+', Punctuation), + (words(('include', 'hash_data', 'regsub', 'regsuball', 'if', 'else', + 'elsif', 'elif', 'synth', 'synthetic', 'ban', 'synth', + 'return', 'set', 'unset', 'import', 'include', 'new', + 'rollback', 'call'), suffix=r'\b'), + Keyword), + (r'storage\.\w+\.\w+\b', Name.Variable), + (words(('true', 'false')), Name.Builtin), + (r'\d+\b', Number), + (r'(backend)(\s+\w+)(\s*{)', + bygroups(Keyword, Name.Variable.Global, Punctuation), 'backend'), + (r'(probe\s)(\s*\w+\s)({)', + bygroups(Keyword, Name.Variable.Global, Punctuation), 'probe'), + (r'(acl\s)(\s*\w+\s)({)', + bygroups(Keyword, Name.Variable.Global, Punctuation), 'acl'), + (r'(vcl )(4.0)(;)$', + bygroups(Keyword.Reserved, Name.Constant, Punctuation)), + (r'(sub\s+)([a-zA-Z]\w*)(\s*{)', + bygroups(Keyword, Name.Function, Punctuation)), + (r'([a-zA-Z_]\w*)' + r'(\.)' + r'([a-zA-Z_]\w*)' + r'(\s*\(.*\))', + bygroups(Name.Function, Punctuation, Name.Function, using(this))), + ('[a-zA-Z_]\w*', Name), + ], + 'comment': [ + (r'[^*/]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + 'comments': [ + (r'#.*$', Comment), + (r'/\*', Comment.Multiline, 'comment'), + (r'//.*$', Comment), + ], + 'string': [ + (r'"', String, '#pop'), + (r'[^"\n]+', String), # all other characters + ], + 'multistring': [ + (r'[^"}]', String), + (r'"}', String, '#pop'), + (r'["}]', String), + ], + 'whitespace': [ + (r'L?"', String, 'string'), + (r'{"', String, 'multistring'), + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + ], + 'root': [ + include('whitespace'), + include('comments'), + include('statements'), + (r'\s+', Text), + ], + } + + +class VCLSnippetLexer(VCLLexer): + """ + For Varnish Configuration Language snippets. + + .. versionadded:: 2.2 + """ + name = 'VCLSnippets' + aliases = ['vclsnippets', 'vclsnippet'] + mimetypes = ['text/x-vclsnippet'] + filenames = [] + + tokens = { + 'snippetspre': [ + (r'\.\.\.+', Comment), + (r'(bereq|req|req_top|resp|beresp|obj|client|server|local|remote|' + r'storage)($|\.\*)', Name.Variable), + ], + 'snippetspost': [ + (r'(backend)(\b|$)', Keyword.Reserved), + ], + 'root': [ + include('snippetspre'), + inherit, + include('snippetspost'), + ], + } diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py index d7a0564a..4efd196e 100644 --- a/pygments/styles/__init__.py +++ b/pygments/styles/__init__.py @@ -41,6 +41,7 @@ STYLE_MAP = { 'lovelace': 'lovelace::LovelaceStyle', 'algol': 'algol::AlgolStyle', 'algol_nu': 'algol_nu::Algol_NuStyle', + 'arduino': 'arduino::ArduinoStyle' } diff --git a/pygments/styles/arduino.py b/pygments/styles/arduino.py index cb4d17b0..5b31bb84 100644 --- a/pygments/styles/arduino.py +++ b/pygments/styles/arduino.py @@ -29,7 +29,7 @@ class ArduinoStyle(Style): Comment: "#95a5a6", # class: 'c' Comment.Multiline: "", # class: 'cm' - Comment.Preproc: "#434f54", # class: 'cp' + Comment.Preproc: "#728E00", # class: 'cp' Comment.Single: "", # class: 'c1' Comment.Special: "", # class: 'cs' @@ -38,15 +38,15 @@ class ArduinoStyle(Style): Keyword.Declaration: "", # class: 'kd' Keyword.Namespace: "", # class: 'kn' Keyword.Pseudo: "#00979D", # class: 'kp' - Keyword.Reserved: "", # class: 'kr' + Keyword.Reserved: "#00979D", # class: 'kr' Keyword.Type: "#00979D", # class: 'kt' - Operator: "#434f54", # class: 'o' + Operator: "#728E00", # class: 'o' Operator.Word: "", # class: 'ow' Name: "#434f54", # class: 'n' Name.Attribute: "", # class: 'na' - Name.Builtin: "", # class: 'nb' + Name.Builtin: "#728E00", # class: 'nb' Name.Builtin.Pseudo: "", # class: 'bp' Name.Class: "", # class: 'nc' Name.Constant: "", # class: 'no' @@ -64,7 +64,7 @@ class ArduinoStyle(Style): Name.Variable.Global: "", # class: 'vg' Name.Variable.Instance: "", # class: 'vi' - Number: "#434f54", # class: 'm' + Number: "#8A7B52", # class: 'm' Number.Float: "", # class: 'mf' Number.Hex: "", # class: 'mh' Number.Integer: "", # class: 'mi' @@ -95,4 +95,4 @@ class ArduinoStyle(Style): Generic.Strong: "", # class: 'gs' Generic.Subheading: "", # class: 'gu' Generic.Traceback: "", # class: 'gt' - } + }
\ No newline at end of file diff --git a/pygments/styles/lovelace.py b/pygments/styles/lovelace.py index 4009274c..236dde9b 100644 --- a/pygments/styles/lovelace.py +++ b/pygments/styles/lovelace.py @@ -62,14 +62,18 @@ class LovelaceStyle(Style): Name.Entity: _ESCAPE_LIME, Name.Exception: _EXCEPT_YELLOW, Name.Function: _FUN_BROWN, + Name.Function.Magic: _DOC_ORANGE, Name.Label: _LABEL_CYAN, Name.Namespace: _LABEL_CYAN, Name.Tag: _KW_BLUE, Name.Variable: '#b04040', Name.Variable.Global:_EXCEPT_YELLOW, + Name.Variable.Magic: _DOC_ORANGE, String: _STR_RED, + String.Affix: '#444444', String.Char: _OW_PURPLE, + String.Delimiter: _DOC_ORANGE, String.Doc: 'italic '+_DOC_ORANGE, String.Escape: _ESCAPE_LIME, String.Interpol: 'underline', diff --git a/pygments/styles/perldoc.py b/pygments/styles/perldoc.py index 47a097ca..eae6170d 100644 --- a/pygments/styles/perldoc.py +++ b/pygments/styles/perldoc.py @@ -41,7 +41,7 @@ class PerldocStyle(Style): Operator.Word: '#8B008B', Keyword: '#8B008B bold', - Keyword.Type: '#a7a7a7', + Keyword.Type: '#00688B', Name.Class: '#008b45 bold', Name.Exception: '#008b45 bold', diff --git a/pygments/token.py b/pygments/token.py index fa3b1e11..40c3214a 100644 --- a/pygments/token.py +++ b/pygments/token.py @@ -147,6 +147,7 @@ STANDARD_TYPES = { Name.Entity: 'ni', Name.Exception: 'ne', Name.Function: 'nf', + Name.Function.Magic: 'fm', Name.Property: 'py', Name.Label: 'nl', Name.Namespace: 'nn', @@ -156,13 +157,16 @@ STANDARD_TYPES = { Name.Variable.Class: 'vc', Name.Variable.Global: 'vg', Name.Variable.Instance: 'vi', + Name.Variable.Magic: 'vm', Literal: 'l', Literal.Date: 'ld', String: 's', + String.Affix: 'sa', String.Backtick: 'sb', String.Char: 'sc', + String.Delimiter: 'dl', String.Doc: 'sd', String.Double: 's2', String.Escape: 'se', diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py index cedd0988..4b7db41a 100755 --- a/scripts/debug_lexer.py +++ b/scripts/debug_lexer.py @@ -109,6 +109,8 @@ def main(fn, lexer=None, options={}): lxcls = find_lexer_class(name) if lxcls is None: raise AssertionError('no lexer found for file %r' % fn) + print('Using lexer: %s (%s.%s)' % (lxcls.name, lxcls.__module__, + lxcls.__name__)) debug_lexer = False # if profile: # # does not work for e.g. ExtendedRegexLexers @@ -54,7 +54,7 @@ else: setup( name = 'Pygments', - version = '2.1.1', + version = '2.2', url = 'http://pygments.org/', license = 'BSD License', author = 'Georg Brandl', diff --git a/tests/examplefiles/example2.cpp b/tests/examplefiles/example2.cpp new file mode 100644 index 00000000..ccd99383 --- /dev/null +++ b/tests/examplefiles/example2.cpp @@ -0,0 +1,20 @@ +/* + * A Test file for the different string literals. + */ + +#include <iostream> + +int main() { + char *_str = "a normal string"; + wchar_t *L_str = L"a wide string"; + char *u8_str = u8"utf-8 string"; + char16_t *u_str = u"utf-16 string"; + char32_t *U_str = U"utf-32 string"; + char *R_str = R""""(raw string with +""" +as a delimiter)""""; + + std::cout << R_str << std::endl; + + return 0; +} diff --git a/tests/examplefiles/postgresql_test.txt b/tests/examplefiles/postgresql_test.txt index 190d184f..28db5ee3 100644 --- a/tests/examplefiles/postgresql_test.txt +++ b/tests/examplefiles/postgresql_test.txt @@ -45,3 +45,37 @@ $$; SELECT U&'\0441\043B\043E\043D' FROM U&"\0441\043B\043E\043D"; +-- Escapes +SELECT E'1\n2\n3'; + +-- DO example from postgresql documentation +/* + * PostgreSQL is Copyright © 1996-2016 by the PostgreSQL Global Development Group. + * + * Postgres95 is Copyright © 1994-5 by the Regents of the University of California. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without a written agreement + * is hereby granted, provided that the above copyright notice and this paragraph + * and the following two paragraphs appear in all copies. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING + * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, + * EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS, + * AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, + * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ +DO $$DECLARE r record; +BEGIN + FOR r IN SELECT table_schema, table_name FROM information_schema.tables + WHERE table_type = 'VIEW' AND table_schema = 'public' + LOOP + EXECUTE 'GRANT ALL ON ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name) || ' TO webuser'; + END LOOP; +END$$; diff --git a/tests/examplefiles/test.erl b/tests/examplefiles/test.erl index 5b983e75..d4ab4825 100644 --- a/tests/examplefiles/test.erl +++ b/tests/examplefiles/test.erl @@ -152,6 +152,18 @@ a_binary() -> a_list_comprehension() -> [X*2 || X <- [1,2,3]]. +a_map() -> + M0 = #{ a => 1, b => 2 }, + M1 = M0#{ b := 200 }. + +escape_sequences() -> + [ "\b\d\e\f\n\r\s\t\v\'\"\\" + , "\1\12\123" % octal + , "\x01" % short hex + , "\x{fff}" % long hex + , "\^a\^A" % control characters + ]. + map(Fun, [H|T]) -> [Fun(H) | map(Fun, T)]; diff --git a/tests/examplefiles/test.escript b/tests/examplefiles/test.escript new file mode 100644 index 00000000..3fafb803 --- /dev/null +++ b/tests/examplefiles/test.escript @@ -0,0 +1,4 @@ +#!/usr/bin/env escript + +main(_Args) -> + ok. diff --git a/tests/examplefiles/test.php b/tests/examplefiles/test.php index 2ce4023e..e8efdc6a 100644 --- a/tests/examplefiles/test.php +++ b/tests/examplefiles/test.php @@ -505,11 +505,40 @@ function &byref() { return $x; } +// Test highlighting of magic methods and variables +class MagicClass { + public $magic_str; + public $ordinary_str; + + public function __construct($some_var) { + $this->magic_str = __FILE__; + $this->ordinary_str = $some_var; + } + + public function __toString() { + return $this->magic_str; + } + + public function nonMagic() { + return $this->ordinary_str; + } +} + +$magic = new MagicClass(__DIR__); +__toString(); +$magic->nonMagic(); +$magic->__toString(); + echo <<<EOF Test the heredocs... EOF; +echo <<<"some_delimiter" +more heredoc testing +continues on this line +some_delimiter; + ?> diff --git a/tests/examplefiles/example.ts b/tests/examplefiles/typescript_example index 760e2543..760e2543 100644 --- a/tests/examplefiles/example.ts +++ b/tests/examplefiles/typescript_example diff --git a/tests/examplefiles/typoscript_example b/tests/examplefiles/typoscript_example new file mode 100644 index 00000000..e2fccf5d --- /dev/null +++ b/tests/examplefiles/typoscript_example @@ -0,0 +1,1930 @@ +# *************************************************************************** +# Notice: "styles." (and "temp.") objects are UNSET after template parsing! +# Use "lib." for persisting storage of objects. +# *************************************************************************** + +<INCLUDE_TYPOSCRIPT: source="FILE: EXT:www_tue_nl/Configuration/TypoScript/Setup/Root.ts"> + +page.80 = RECORDS +page.80 { + source = 1 + tables = tt_address + conf.tt_address = COA + conf.tt_address { + 20 = TEXT + 20.field = email + 20.typolink.parameter.field = email + } +} + + /* +page.200 = PHP_SCRIPT_EXT +page.200 { + 1 = TMENU + 1.wrap = <div style="width:200px; border: 1px solid;">|</div> + 1.expAll = 1 + 1.submenuObjSuffixes = a |*| |*| b + 1.NO.allWrap = <b>|</b><br/> + + 2 = TMENU + 2.NO.allWrap = <div style="background:red;">|</div> + + 2a = TMENU + 2a.NO.allWrap = <div style="background:yellow;">|</div> +* + 2b = TMENU + 2b.NO.allWrap = <div style="background:green;">|</div> +} +*/ + + # Add the CSS and JS files +page { + includeCSS { # comment at the end of a line + file99 = fileadmin/your-fancybox.css + } + includeJSFooter { + fancybox = fileadmin/your-fancybox.js + } +} + + # Change the default rendering of images to match lightbox requirements +tt_content.image.20.1.imageLinkWrap { + JSwindow = 0 + test = MyExtension\Path\To\Class + + directImageLink = 1 + linkParams.ATagParams { + dataWrap = class= "lightbox" rel="fancybox{field:uid}" + } +} + +tt_content.image.20.1.imageLinkWrap > +tt_content.image.20.1.imageLinkWrap = 1 +tt_content.image.20.1.imageLinkWrap { + enable = 1 + typolink { + # directly link to the recent image + parameter.cObject = IMG_RESOURCE + parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile + parameter.cObject.file.maxW = {$styles.content.imgtext.maxW} + parameter.override.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT + title.field = imagecaption // title + title.split.token.char = 10 + title.if.isTrue.field = imagecaption // header + title.split.token.char = 10 + title.split.returnKey.data = register : IMAGE_NUM_CURRENT + parameter.cObject = IMG_RESOURCE + parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile + ATagParams = target="_blank" + } +} + +10 = IMAGE +10 { + # point to the image + file = fileadmin/demo/lorem_ipsum/images/a4.jpg + # make it rather small + file.width = 80 + # add a link to tx_cms_showpic.php that shows the original image + imageLinkWrap = 1 + imageLinkWrap { + enable = 1 + # JSwindow = 1 + } +} + +# Clear out any constants in this reserved room! +styles.content > + +# get content +styles.content.get = CONTENT +styles.content.get { + table = tt_content + select.orderBy = sorting + select.where = colPos=0 + select.languageField = sys_language_uid +} + +# get content, left +styles.content.getLeft < styles.content.get +styles.content.getLeft.select.where = colPos=1 + +# get content, right +styles.content.getRight < styles.content.get +styles.content.getRight.select.where = colPos=2 + +# get content, margin +styles.content.getBorder < styles.content.get +styles.content.getBorder.select.where = colPos=3 + +# get news +styles.content.getNews < styles.content.get +styles.content.getNews.select.pidInList = {$styles.content.getNews.newsPid} + +# Edit page object: +styles.content.editPanelPage = COA +styles.content.editPanelPage { + 10 = EDITPANEL + 10 { + allow = toolbar,move,hide + label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.page + label.wrap = | <b>%s</b> + } +} + + + + + + + + + + + +# ********************************************************************* +# "lib." objects are preserved from unsetting after template parsing +# ********************************************************************* + +# Creates persistent ParseFunc setup for non-HTML content. This is recommended to use (as a reference!) +lib.parseFunc { + makelinks = 1 + makelinks.http.keep = {$styles.content.links.keep} + makelinks.http.extTarget = {$styles.content.links.extTarget} + makelinks.mailto.keep = path + tags { + link = TEXT + link { + current = 1 + typolink.parameter.data = parameters : allParams + typolink.extTarget = {$styles.content.links.extTarget} + typolink.target = {$styles.content.links.target} + parseFunc.constants =1 + } + } + allowTags = {$styles.content.links.allowTags} + denyTags = * + sword = <span class="csc-sword">|</span> + constants = 1 + + nonTypoTagStdWrap.HTMLparser = 1 + nonTypoTagStdWrap.HTMLparser { + keepNonMatchedTags = 1 + htmlSpecialChars = 2 + } +} + +# good old parsefunc in "styles.content.parseFunc" is created for backwards compatibility. Don't use it, just ignore. +styles.content.parseFunc < lib.parseFunc + +# Creates persistent ParseFunc setup for RTE content (which is mainly HTML) based on the "ts_css" transformation. +lib.parseFunc_RTE < lib.parseFunc +lib.parseFunc_RTE { + // makelinks > + # Processing <table> and <blockquote> blocks separately + externalBlocks = table, blockquote, dd, dl, ol, ul, div + externalBlocks { + # The blockquote content is passed into parseFunc again... + blockquote.stripNL=1 + blockquote.callRecursive=1 + blockquote.callRecursive.tagStdWrap.HTMLparser = 1 + blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style="margin-bottom:0;margin-top:0;" + + ol.stripNL=1 + ol.stdWrap.parseFunc = < lib.parseFunc + + ul.stripNL=1 + ul.stdWrap.parseFunc = < lib.parseFunc + + table.stripNL=1 + table.stdWrap.HTMLparser = 1 + table.stdWrap.HTMLparser.tags.table.fixAttrib.class { + default = contenttable + always = 1 + list = contenttable + } + table.stdWrap.HTMLparser.keepNonMatchedTags = 1 + table.HTMLtableCells=1 + table.HTMLtableCells { + default.callRecursive=1 + addChr10BetweenParagraphs=1 + } + div.stripNL = 1 + div.callRecursive = 1 + + # Definition list processing + dl < .div + dd < .div + } + nonTypoTagStdWrap.encapsLines { + encapsTagList = p,pre,h1,h2,h3,h4,h5,h6,hr,dt + remapTag.DIV = P + nonWrappedTag = P + innerStdWrap_all.ifBlank = + addAttributes.P.class = bodytext + addAttributes.P.class.setOnly=blank + } + nonTypoTagStdWrap.HTMLparser = 1 + nonTypoTagStdWrap.HTMLparser { + keepNonMatchedTags = 1 + htmlSpecialChars = 2 + } +} + + +# Content header: +lib.stdheader = COA +lib.stdheader { + + # Create align style-attribute for <Hx> tags + 2 = LOAD_REGISTER + 2.headerStyle.field = header_position + 2.headerStyle.required = 1 + 2.headerStyle.noTrimWrap = | style="text-align:|;"| + + # Create class="csc-firstHeader" attribute for <Hx> tags + 3 = LOAD_REGISTER + 3.headerClass = csc-firstHeader + 3.headerClass.if.value=1 + 3.headerClass.if.equals.data = cObj:parentRecordNumber + 3.headerClass.noTrimWrap = | class="|"| + + # Date format: + 5 = TEXT + 5.field = date + 5.if.isTrue.field = date + 5.strftime = %x + 5.wrap = <p class="csc-header-date">|</p> + 5.prefixComment = 2 | Header date: + + # This CASE cObject renders the header content: + # currentValue is set to the header data, possibly wrapped in link-tags. + 10 = CASE + 10.setCurrent { + field = header + htmlSpecialChars = 1 + typolink.parameter.field = header_link + } + 10.key.field = header_layout + 10.key.ifEmpty = {$content.defaultHeaderType} + 10.key.ifEmpty.override.data = register: defaultHeaderType + + 10.1 = TEXT + 10.1.current = 1 + 10.1.dataWrap = <h1{register:headerStyle}{register:headerClass}>|</h1> + + 10.2 < .10.1 + 10.2.dataWrap = <h2{register:headerStyle}{register:headerClass}>|</h2> + + 10.3 < .10.1 + 10.3.dataWrap = <h3{register:headerStyle}{register:headerClass}>|</h3> + + 10.4 < .10.1 + 10.4.dataWrap = <h4{register:headerStyle}{register:headerClass}>|</h4> + + 10.5 < .10.1 + 10.5.dataWrap = <h5{register:headerStyle}{register:headerClass}>|</h5> + + # Pops the used registers off the stack: + 98 = RESTORE_REGISTER + 99 = RESTORE_REGISTER + + # Post-processing: + stdWrap.fieldRequired = header + stdWrap.if { + equals.field = header_layout + value = 100 + negate = 1 + } + + stdWrap.editIcons = tt_content : header, [header_layout | header_position], [header_link|date] + stdWrap.editIcons.beforeLastTag = 1 + stdWrap.editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.header + + stdWrap.dataWrap = <div class="csc-header csc-header-n{cObj:parentRecordNumber}">|</div> + stdWrap.prefixComment = 2 | Header: +} + + + + + + + + + + + + + + + +#****************************************************** +# Including library for processing of some elements: +#****************************************************** +includeLibs.tx_cssstyledcontent_pi1 = EXT:css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php + + +#********************************** +# tt_content is started +#********************************** +tt_content > +tt_content = CASE +tt_content.key.field = CType +tt_content.stdWrap { + innerWrap.cObject = CASE + innerWrap.cObject { + key.field = section_frame + + default = COA + default { + 10 = TEXT + 10 { + value = <div id="c{field:uid}" + override.cObject = TEXT + override.cObject { + value = <div + if.value = div + if.equals.field = CType + } + insertData = 1 + } + + 15 = TEXT + 15 { + value = csc-default + noTrimWrap = | class="|" | + required = 1 + } + + 20 = COA + 20 { + 10 = COA + 10 { + 10 = TEXT + 10 { + value = {$content.spaceBefore} + wrap = |+ + if.isTrue = {$content.spaceBefore} + } + + 20 = TEXT + 20 { + field = spaceBefore + } + + stdWrap { + prioriCalc = intval + wrap = margin-top:|px; + required = 1 + ifEmpty.value = + } + } + + 20 = COA + 20 { + 10 = TEXT + 10 { + value = {$content.spaceAfter} + wrap = |+ + if.isTrue = {$content.spaceAfter} + } + + 20 = TEXT + 20 { + field = spaceAfter + } + + stdWrap { + prioriCalc = intval + wrap = margin-bottom:|px; + required = 1 + ifEmpty.value = + } + } + + stdWrap.noTrimWrap = | style="|" | + stdWrap.required = 1 + } + 30 = TEXT + 30.value = >|</div> + } + + 1 =< tt_content.stdWrap.innerWrap.cObject.default + 1.15.value = csc-frame csc-frame-invisible + + 5 =< tt_content.stdWrap.innerWrap.cObject.default + 5.15.value = csc-frame csc-frame-rulerBefore + + 6 =< tt_content.stdWrap.innerWrap.cObject.default + 6.15.value = csc-frame csc-frame-rulerAfter + + 10 =< tt_content.stdWrap.innerWrap.cObject.default + 10.15.value = csc-frame csc-frame-indent + + 11 =< tt_content.stdWrap.innerWrap.cObject.default + 11.15.value = csc-frame csc-frame-indent3366 + + 12 =< tt_content.stdWrap.innerWrap.cObject.default + 12.15.value = csc-frame csc-frame-indent6633 + + 20 =< tt_content.stdWrap.innerWrap.cObject.default + 20.15.value = csc-frame csc-frame-frame1 + + 21 =< tt_content.stdWrap.innerWrap.cObject.default + 21.15.value = csc-frame csc-frame-frame2 + + 66 = COA + 66 { + 10 = TEXT + 10 { + value = <a id="c{field:uid}"></a> + insertData = 1 + } + + 20 = COA + 20 { + 10 = TEXT + 10 { + value = {$content.spaceBefore} + wrap = |+ + if.isTrue = {$content.spaceBefore} + } + + 20 = TEXT + 20 { + field = spaceBefore + } + + stdWrap { + prioriCalc = intval + wrap = margin-top:|px; + required = 1 + ifEmpty.value = + wrap2 = <div style="|"></div> + } + } + + 30 = TEXT + 30 { + value = | + } + + 40 < .20 + 40 { + 10 { + value = {$content.spaceAfter} + if.isTrue = {$content.spaceAfter} + } + 20.field = spaceAfter + stdWrap.wrap = margin-bottom:|px; + } + } + + } + + innerWrap2 = | <p class="csc-linkToTop"><a href="#">{LLL:EXT:css_styled_content/pi1/locallang.xml:label.toTop}</a></p> + innerWrap2.insertData = 1 + innerWrap2.fieldRequired = linkToTop + + prepend = TEXT + prepend.dataWrap = <a id="c{field:_LOCALIZED_UID}"></a> + prepend.if.isTrue.field = _LOCALIZED_UID + + editPanel = 1 + editPanel { + allow = move,new,edit,hide,delete + line = 5 + label = %s + onlyCurrentPid = 1 + previewBorder = 4 + edit.displayRecord = 1 + } + + prefixComment = 1 | CONTENT ELEMENT, uid:{field:uid}/{field:CType} +} + + + +# ***************** +# CType: header +# ***************** +# See Object path "lib.stdheader" +tt_content.header = COA +tt_content.header { + 10 = < lib.stdheader + + 20 = TEXT + 20 { + field = subheader + required = 1 + + dataWrap = <p class="csc-subheader csc-subheader-{field:layout}">|</p> + htmlSpecialChars = 1 + + editIcons = tt_content:subheader,layout + editIcons.beforeLastTag = 1 + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.subheader + + prefixComment = 2 | Subheader: + } +} + + + +# ***************** +# CType: text +# ***************** +tt_content.text = COA +tt_content.text { + 10 = < lib.stdheader + + 20 = TEXT + 20 { + field = bodytext + required = 1 + + parseFunc = < lib.parseFunc_RTE + + editIcons = tt_content:bodytext, rte_enabled + editIcons.beforeLastTag = 1 + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.bodytext + + prefixComment = 2 | Text: + } +} + + + +# ***************** +# CType: image +# ***************** +# (also used for rendering 'textpic' type): +tt_content.image = COA +tt_content.image.10 = < lib.stdheader +tt_content.image.20 = USER +tt_content.image.20 { + userFunc = tx_cssstyledcontent_pi1->render_textpic + + # Image source + imgList.field = image + imgPath = uploads/pics/ + + # Single image rendering + imgObjNum = 1 + 1 { + file.import.current = 1 + file.width.field = imagewidth + imageLinkWrap = 1 + imageLinkWrap { + bodyTag = <body style="margin:0; background:#fff;"> + wrap = <a href="javascript:close();"> | </a> + width = {$styles.content.imgtext.linkWrap.width} + height = {$styles.content.imgtext.linkWrap.height} + effects = {$styles.content.imgtext.linkWrap.effects} + + JSwindow = 1 + JSwindow.newWindow = {$styles.content.imgtext.linkWrap.newWindow} + JSwindow.if.isFalse = {$styles.content.imgtext.linkWrap.lightboxEnabled} + + directImageLink = {$styles.content.imgtext.linkWrap.lightboxEnabled} + + enable.field = image_zoom + enable.ifEmpty.typolink.parameter.field = image_link + enable.ifEmpty.typolink.parameter.listNum.splitChar = 10 + enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT + enable.ifEmpty.typolink.returnLast = url + + typolink.parameter.field = image_link + typolink.parameter.listNum.splitChar = 10 + typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT + typolink.target = {$styles.content.links.target} + typolink.extTarget = {$styles.content.links.extTarget} + + linkParams.ATagParams.dataWrap = class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}" + } + + altText = TEXT + altText { + field = altText + stripHtml = 1 + split.token.char = 10 + split.token.if.isTrue = {$styles.content.imgtext.imageTextSplit} + split.returnKey.data = register : IMAGE_NUM_CURRENT + } + + titleText < .altText + titleText.field = titleText + + longdescURL < .altText + longdescURL.field = longdescURL + + emptyTitleHandling = {$styles.content.imgtext.emptyTitleHandling} + titleInLink = {$styles.content.imgtext.titleInLink} + titleInLinkAndImg = {$styles.content.imgtext.titleInLinkAndImg} + } + + textPos.field = imageorient + maxW = {$styles.content.imgtext.maxW} + maxW.override.data = register:maxImageWidth + maxWInText = {$styles.content.imgtext.maxWInText} + maxWInText.override.data = register:maxImageWidthInText + + equalH.field = imageheight + + image_compression.field = image_compression + image_effects.field = image_effects + + noRows.field = image_noRows + + cols.field = imagecols + border.field = imageborder + + caption { + 1 = TEXT + 1 { + field = imagecaption + required = 1 + parseFunc =< lib.parseFunc + br = 1 + split.token.char = 10 + split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit} + split.returnKey.data = register : IMAGE_NUM_CURRENT + } + } + # captionSplit is deprecated, use imageTextSplit instead + captionSplit = {$styles.content.imgtext.captionSplit} + captionAlign.field = imagecaption_position + # caption/alttext/title/longdescURL splitting + imageTextSplit = {$styles.content.imgtext.imageTextSplit} + + borderCol = {$styles.content.imgtext.borderColor} + borderThick = {$styles.content.imgtext.borderThick} + borderClass = {$styles.content.imgtext.borderClass} + colSpace = {$styles.content.imgtext.colSpace} + rowSpace = {$styles.content.imgtext.rowSpace} + textMargin = {$styles.content.imgtext.textMargin} + + borderSpace = {$styles.content.imgtext.borderSpace} + separateRows = {$styles.content.imgtext.separateRows} + addClasses = + addClassesImage = + addClassesImage.ifEmpty = csc-textpic-firstcol csc-textpic-lastcol + addClassesImage.override = csc-textpic-firstcol |*| |*| csc-textpic-lastcol + addClassesImage.override.if { + isGreaterThan.field = imagecols + value = 1 + } + + # + imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap" style="width:{register:totalwidth}px;"> | </div> + imageStdWrapNoWidth.wrap = <div class="csc-textpic-imagewrap"> | </div> + + # if noRows is set, wrap around each column: + imageColumnStdWrap.dataWrap = <div class="csc-textpic-imagecolumn" style="width:{register:columnwidth}px;"> | </div> + + layout = CASE + layout { + key.field = imageorient + # above-center + default = TEXT + default.value = <div class="csc-textpic csc-textpic-center csc-textpic-above###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div> + # above-right + 1 = TEXT + 1.value = <div class="csc-textpic csc-textpic-right csc-textpic-above###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div> + # above-left + 2 = TEXT + 2.value = <div class="csc-textpic csc-textpic-left csc-textpic-above###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div> + # below-center + 8 = TEXT + 8.value = <div class="csc-textpic csc-textpic-center csc-textpic-below###CLASSES###">###TEXT######IMAGES###</div><div class="csc-textpic-clear"><!-- --></div> + # below-right + 9 = TEXT + 9.value = <div class="csc-textpic csc-textpic-right csc-textpic-below###CLASSES###">###TEXT######IMAGES###</div><div class="csc-textpic-clear"><!-- --></div> + # below-left + 10 = TEXT + 10.value = <div class="csc-textpic csc-textpic-left csc-textpic-below###CLASSES###">###TEXT######IMAGES###</div><div class="csc-textpic-clear"><!-- --></div> + # intext-right + 17 = TEXT + 17.value = <div class="csc-textpic csc-textpic-intext-right###CLASSES###">###IMAGES######TEXT###</div> + 17.override = <div class="csc-textpic csc-textpic-intext-right###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div> + 17.override.if.isTrue = {$styles.content.imgtext.addIntextClearer} + # intext-left + 18 = TEXT + 18.value = <div class="csc-textpic csc-textpic-intext-left###CLASSES###">###IMAGES######TEXT###</div> + 18.override = <div class="csc-textpic csc-textpic-intext-left###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div> + 18.override.if.isTrue = {$styles.content.imgtext.addIntextClearer} + # intext-right-nowrap + 25 = TEXT + 25.value = <div class="csc-textpic csc-textpic-intext-right-nowrap###CLASSES###">###IMAGES###<div style="margin-right:{register:rowWidthPlusTextMargin}px;">###TEXT###</div></div><div class="csc-textpic-clear"><!-- --></div> + 25.insertData = 1 + # intext-left-nowrap + 26 = TEXT + 26.value = <div class="csc-textpic csc-textpic-intext-left-nowrap###CLASSES###">###IMAGES###<div style="margin-left:{register:rowWidthPlusTextMargin}px;">###TEXT###</div></div><div class="csc-textpic-clear"><!-- --></div> + 26.insertData = 1 + } + + rendering { + dl { + # Choose another rendering for special edge cases + fallbackRendering = COA + fallbackRendering { + # Just one image without a caption => don't need the dl-overhead, use the "simple" rendering + 10 = TEXT + 10 { + if { + isFalse.field = imagecaption + value = 1 + equals.data = register:imageCount + } + value = simple + } + + # Multiple images and one global caption => "ul" + 20 = TEXT + 20 { + if { + value = 1 + isGreaterThan.data = register:imageCount + isTrue.if.isTrue.data = register:renderGlobalCaption + isTrue.field = imagecaption + } + value = ul + } + + # Multiple images and no caption at all => "ul" + 30 = TEXT + 30 { + if { + value = 1 + isGreaterThan.data = register:imageCount + isFalse.field = imagecaption + } + value = ul + } + } + imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"> | </div> + imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"> | </div> + noRowsStdWrap.wrap = + oneImageStdWrap.dataWrap = <dl class="csc-textpic-image###CLASSES###" style="width:{register:imagespace}px;"> | </dl> + imgTagStdWrap.wrap = <dt> | </dt> + editIconsStdWrap.wrap = <dd> | </dd> + caption { + required = 1 + wrap = <dd class="csc-textpic-caption"> | </dd> + } + } + ul { + # Just one image without a caption => don't need the ul-overhead, use the "simple" rendering + fallbackRendering < tt_content.image.20.rendering.dl.fallbackRendering.10 + imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"><ul> | </ul></div> + imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"><ul> | </ul></div> + noRowsStdWrap.wrap = <ul> | </ul> + oneImageStdWrap.dataWrap = <li class="csc-textpic-image###CLASSES###" style="width:{register:imagespace}px;"> | </li> + imgTagStdWrap.wrap = + editIconsStdWrap.wrap = <div> | </div> + caption.wrap = <div class="csc-textpic-caption"> | </div> + } + div { + # Just one image without a caption => don't need the div-overhead, use the "simple" rendering + fallbackRendering < tt_content.image.20.rendering.dl.fallbackRendering.10 + imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"> | </div> + imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"> | </div> + noRowsStdWrap.wrap = + oneImageStdWrap.dataWrap = <div class="csc-textpic-image###CLASSES###" style="width:{register:imagespace}px;"> | </div> + imgTagStdWrap.wrap = <div> | </div> + editIconsStdWrap.wrap = <div> | </div> + caption.wrap = <div class="csc-textpic-caption"> | </div> + } + simple { + imageRowStdWrap.dataWrap = | + imageLastRowStdWrap.dataWrap = | + noRowsStdWrap.wrap = + oneImageStdWrap.dataWrap = | + imgTagStdWrap.wrap = | + editIconsStdWrap.wrap = | + caption.wrap = <div class="csc-textpic-caption"> | </div> + imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap csc-textpic-single-image" style="width:{register:totalwidth}px;"> | </div> + imageStdWrapNoWidth.wrap = <div class="csc-textpic-imagewrap csc-textpic-single-image"> | </div> + } + } + renderMethod = dl + + editIcons = tt_content : image [imageorient|imagewidth|imageheight], [imagecols|image_noRows|imageborder],[image_link|image_zoom],[image_compression|image_effects|image_frames],imagecaption[imagecaption_position] + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.images + + caption.editIcons = tt_content : imagecaption[imagecaption_position] + caption.editIcons.beforeLastTag=1 + caption.editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.caption + + stdWrap.prefixComment = 2 | Image block: +} + +# ***************** +# CType: textpic +# ***************** +tt_content.textpic = COA +tt_content.textpic { + 10 = COA + 10.if.value = 25 + 10.if.isLessThan.field = imageorient + 10.10 = < lib.stdheader + + 20 = < tt_content.image.20 + 20 { + text.10 = COA + text.10 { + if.value = 24 + if.isGreaterThan.field = imageorient + 10 = < lib.stdheader + 10.stdWrap.dataWrap = <div class="csc-textpicHeader csc-textpicHeader-{field:imageorient}">|</div> + } + text.20 = < tt_content.text.20 + text.wrap = <div class="csc-textpic-text"> | </div> + } +} + + + +# ***************** +# CType: bullet +# ***************** +tt_content.bullets = COA +tt_content.bullets { + 10 = < lib.stdheader + + 20 = TEXT + 20 { + field = bodytext + trim = 1 + split{ + token.char = 10 + cObjNum = |*|1|| 2|*| + 1.current = 1 + 1.parseFunc =< lib.parseFunc + 1.wrap = <li class="odd">|</li> + + 2.current = 1 + 2.parseFunc =< lib.parseFunc + 2.wrap = <li class="even">|</li> + } + dataWrap = <ul class="csc-bulletlist csc-bulletlist-{field:layout}">|</ul> + editIcons = tt_content: bodytext, [layout] + editIcons.beforeLastTag = 1 + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.php:eIcon.bullets + + prefixComment = 2 | Bullet list: + } +} + + + +# ***************** +# CType: table +# ***************** +# Rendered by a PHP function specifically written to handle CE tables. See css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php +tt_content.table = COA +tt_content.table { + 10 = < lib.stdheader + + 20 = USER + 20.userFunc = tx_cssstyledcontent_pi1->render_table + 20.field = bodytext + + 20.color { + default = + 1 = #EDEBF1 + 2 = #F5FFAA + } + 20.tableParams_0 { + border = + cellpadding = + cellspacing = + } + 20.tableParams_1 { + border = + cellpadding = + cellspacing = + } + 20.tableParams_2 { + border = + cellpadding = + cellspacing = + } + 20.tableParams_3 { + border = + cellpadding = + cellspacing = + } + 20.innerStdWrap.wrap = | + 20.innerStdWrap.parseFunc = < lib.parseFunc + + 20.stdWrap { + editIcons = tt_content: cols, bodytext, [layout], [table_bgColor|table_border|table_cellspacing|table_cellpadding] + editIcons.beforeLastTag = 1 + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.table + + prefixComment = 2 | Table: + } +} + + +# ***************** +# CType: uploads +# ***************** +# Rendered by a PHP function specifically written to handle CE filelists. See css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php +tt_content.uploads = COA +tt_content.uploads { + 10 = < lib.stdheader + + 20 = USER + 20.userFunc = tx_cssstyledcontent_pi1->render_uploads + 20.field = media + 20.filePath.field = select_key + + 20 { + # Rendering for each file (e.g. rows of the table) as a cObject + itemRendering = COA + itemRendering { + wrap = <tr class="tr-odd tr-first">|</tr> |*| <tr class="tr-even">|</tr> || <tr class="tr-odd">|</tr> |*| + + 10 = TEXT + 10.data = register:linkedIcon + 10.wrap = <td class="csc-uploads-icon">|</td> + 10.if.isPositive.field = layout + + 20 = COA + 20.wrap = <td class="csc-uploads-fileName">|</td> + 20.1 = TEXT + 20.1 { + data = register:linkedLabel + wrap = <p>|</p> + } + 20.2 = TEXT + 20.2 { + data = register:description + wrap = <p class="csc-uploads-description">|</p> + required = 1 + htmlSpecialChars = 1 + } + + 30 = TEXT + 30.if.isTrue.field = filelink_size + 30.data = register:fileSize + 30.wrap = <td class="csc-uploads-fileSize">|</td> + 30.bytes = 1 + 30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels} + } + useSpacesInLinkText = 0 + stripFileExtensionFromLinkText = 0 + } + + 20.color { + default = + 1 = #EDEBF1 + 2 = #F5FFAA + } + 20.tableParams_0 { + border = + cellpadding = + cellspacing = + } + 20.tableParams_1 { + border = + cellpadding = + cellspacing = + } + 20.tableParams_2 { + border = + cellpadding = + cellspacing = + } + 20.tableParams_3 { + border = + cellpadding = + cellspacing = + } + + 20.linkProc { + target = _blank + jumpurl = {$styles.content.uploads.jumpurl} + jumpurl.secure = {$styles.content.uploads.jumpurl_secure} + jumpurl.secure.mimeTypes = {$styles.content.uploads.jumpurl_secure_mimeTypes} + removePrependedNumbers = 1 + + iconCObject = IMAGE + iconCObject.file.import.data = register : ICON_REL_PATH + iconCObject.file.width = 150 + } + + 20.filesize { + bytes = 1 + bytes.labels = {$styles.content.uploads.filesizeBytesLabels} + } + + 20.stdWrap { + editIcons = tt_content: media, layout [table_bgColor|table_border|table_cellspacing|table_cellpadding], filelink_size, imagecaption + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.filelist + + prefixComment = 2 | File list: + } +} + + +# ****************** +# CType: multimedia +# ****************** +tt_content.multimedia = COA +tt_content.multimedia { + 10 = < lib.stdheader + + 20 = MULTIMEDIA + 20.file.field = multimedia + 20.file.wrap = uploads/media/ + 20.file.listNum = 0 + 20.params.field = bodytext + + 20.stdWrap { + editIcons = tt_content: multimedia, bodytext + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia + + prefixComment = 2 | Multimedia element: + } +} + +# ***************** +# CType: swfobject +# ***************** +tt_content.swfobject = COA +tt_content.swfobject { + 10 = < lib.stdheader + + 20 = SWFOBJECT + 20 { + file = + width = + height = + + flexParams.field = pi_flexform + + alternativeContent.field = bodytext + + layout = ###SWFOBJECT### + + video { + player = {$styles.content.media.videoPlayer} + + defaultWidth = {$styles.content.media.defaultVideoWidth} + defaultHeight = {$styles.content.media.defaultVideoHeight} + + default { + params.quality = high + params.menu = false + params.allowScriptAccess = sameDomain + params.allowFullScreen = true + } + mapping { + + } + } + + audio { + player = {$styles.content.media.audioPlayer} + + defaultWidth = {$styles.content.media.defaultAudioWidth} + defaultHeight = {$styles.content.media.defaultAudioHeight} + + default { + params.quality = high + params.allowScriptAccess = sameDomain + params.menu = false + } + mapping { + flashvars.file = soundFile + } + } + + } + 20.stdWrap { + editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia + + prefixComment = 2 | SWFobject element: + } +} + +# ***************** +# CType: qtobject +# ***************** +tt_content.qtobject = COA +tt_content.qtobject { + 10 = < lib.stdheader + + 20 = QTOBJECT + 20 { + file = + width = + height = + + flexParams.field = pi_flexform + + alternativeContent.field = bodytext + + layout = ###QTOBJECT### + + video { + player = {$styles.content.media.videoPlayer} + + defaultWidth = {$styles.content.media.defaultVideoWidth} + defaultHeight = {$styles.content.media.defaultVideoHeight} + + default { + params.quality = high + params.menu = false + params.allowScriptAccess = sameDomain + params.allowFullScreen = true + } + mapping { + + } + } + + audio { + player = {$styles.content.media.audioPlayer} + + defaultWidth = {$styles.content.media.defaultAudioWidth} + defaultHeight = {$styles.content.media.defaultAudioHeight} + + default { + params.quality = high + params.allowScriptAccess = sameDomain + params.menu = false + } + mapping { + flashvars.file = soundFile + } + } + } + 20.stdWrap { + editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia + + prefixComment = 2 | QTobject element: + } +} + +# ***************** +# CType: media +# ***************** +tt_content.media = COA +tt_content.media { + 10 = < lib.stdheader + + 20 = MEDIA + 20 { + + flexParams.field = pi_flexform + alternativeContent < tt_content.text.20 + alternativeContent.field = bodytext + + type = video + renderType = auto + allowEmptyUrl = 0 + forcePlayer = 1 + + fileExtHandler { + default = MEDIA + avi = MEDIA + asf = MEDIA + class = MEDIA + wmv = MEDIA + mp3 = SWF + mp4 = SWF + m4v = SWF + swa = SWF + flv = SWF + swf = SWF + mov = QT + m4v = QT + m4a = QT + } + + mimeConf.swfobject < tt_content.swfobject.20 + mimeConf.qtobject < tt_content.qtobject.20 + + } + 20.stdWrap { + editIcons = tt_content: pi_flexform, bodytext + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia + + prefixComment = 2 | Media element: + } +} + +# ****************** +# CType: mailform +# ****************** +tt_content.mailform = COA +tt_content.mailform.10 = < lib.stdheader +tt_content.mailform.20 = FORM +tt_content.mailform.20 { + accessibility = 1 + noWrapAttr=1 + formName = mailform + dontMd5FieldNames = 1 + layout = <div class="csc-mailform-field">###LABEL### ###FIELD###</div> + labelWrap.wrap = | + commentWrap.wrap = | + radioWrap.wrap = |<br /> + radioWrap.accessibilityWrap = <fieldset###RADIO_FIELD_ID###><legend>###RADIO_GROUP_LABEL###</legend>|</fieldset> + REQ = 1 + REQ.labelWrap.wrap = | + COMMENT.layout = <div class="csc-mailform-label">###LABEL###</div> + RADIO.layout = <div class="csc-mailform-field">###LABEL### <span class="csc-mailform-radio">###FIELD###</span></div> + LABEL.layout = <div class="csc-mailform-field">###LABEL### <span class="csc-mailform-label">###FIELD###</span></div> + target = {$styles.content.mailform.target} + goodMess = {$styles.content.mailform.goodMess} + badMess = {$styles.content.mailform.badMess} + redirect.field = pages + redirect.listNum = 0 + recipient.field = subheader + data.field = bodytext + locationData = 1 + hiddenFields.stdWrap.wrap = <div style="display:none;">|</div> + + params.radio = class="csc-mailform-radio" + params.check = class="csc-mailform-check" + params.submit = class="csc-mailform-submit" + + stdWrap.wrap = <fieldset class="csc-mailform"> | </fieldset> + stdWrap { + editIcons = tt_content: bodytext, pages, subheader + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.form + + prefixComment = 2 | Mail form inserted: + } +} + + +# ****************** +# CType: search +# ****************** +tt_content.search = COA +tt_content.search.10 = < lib.stdheader +# Result: +tt_content.search.20 = SEARCHRESULT +tt_content.search.20 { + allowedCols = pages.title-subtitle-keywords-description : tt_content.header-bodytext-imagecaption : tt_address.name-title-address-email-company-city-country : tt_links.title-note-note2-url : tt_board.subject-message-author-email : tt_calender.title-note : tt_products.title-note-itemnumber + languageField.tt_content = sys_language_uid + renderObj = COA + renderObj { + + 10 = TEXT + 10.field = pages_title + 10.htmlSpecialChars = 1 + 10.typolink { + parameter.field = uid + target = {$styles.content.searchresult.resultTarget} + additionalParams.data = register:SWORD_PARAMS + additionalParams.required = 1 + additionalParams.wrap = &no_cache=1 + } + 10.htmlSpecialChars = 1 + 10.wrap = <h3 class="csc-searchResultHeader">|</h3> + + 20 = COA + 20 { + 10 = TEXT + 10.field = tt_content_bodytext + 10.stripHtml = 1 + 10.htmlSpecialChars = 1 + } + 20.stdWrap.crop = 200 | ... + 20.stdWrap.wrap = <p class="csc-searchResult">|</p> + } + + layout = COA + layout { + wrap = <table border="0" cellspacing="0" cellpadding="2" class="csc-searchResultInfo"><tr> | </tr></table> ###RESULT### + + 10 = TEXT + 10.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.resultRange + 10.wrap = <td class="csc-searchResultRange"><p>|</p></td> + + 20 = TEXT + 20.value = ###PREV### ###NEXT### + 20.wrap = <td class="csc-searchResultPrevNext"><p>|</p></td> + } + + noResultObj = COA + noResultObj { + 10 = TEXT + 10.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.emptySearch + 10.wrap = <h3 class="csc-noSearchResultMsg">|</h3> + } + + next = TEXT + next.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchResultNext + + prev = TEXT + prev.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchResultPrev + + target = {$styles.content.searchresult.target} + range = 20 + + stdWrap.prefixComment = 2 | Search result: +} + +# Form: +tt_content.search.30 < tt_content.mailform.20 +tt_content.search.30 { + goodMess = {$styles.content.searchform.goodMess} + redirect > + recipient > + data > + dataArray { + 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchWord + 10.type = sword=input + 20.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchIn + 20.type = scols=select + 20.valueArray { + 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.headersKeywords + 10.value = pages.title-subtitle-keywords-description:tt_content.header + 20.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.pageContent + 20.value = tt_content.header-bodytext-imagecaption + } + 30.type = stype=hidden + 30.value = L0 + 40.type = submit=submit + 40.value.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchButton + } + type.field = pages + type.listNum = 0 + locationData = HTTP_POST_VARS + no_cache = 1 + + stdWrap.wrap = <table border="0" cellspacing="1" cellpadding="1" class="csc-searchform"> | </table> + stdWrap { + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.search + + prefixComment = 2 | Search form inserted: + } +} + + +# ****************** +# CType: login +# ****************** +tt_content.login < tt_content.mailform +tt_content.login.10 = < lib.stdheader +tt_content.login.20 { + goodMess = {$styles.content.loginform.goodMess} + redirect > + recipient > + data > + dataArray { + 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.username + 10.type = *user=input + 20.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.password + 20.type = *pass=password + 30.type = logintype=hidden + 30.value = login + 40.type = submit=submit + 40.value.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.login + } + type.field = pages + type.listNum = 0 + target = {$styles.content.loginform.target} + locationData = 0 + hiddenFields.pid = TEXT + hiddenFields.pid { + value = {$styles.content.loginform.pid} + override.field = pages + override.listNum = 1 + } + + stdWrap.wrap = <div class="csc-loginform"> | </div> + stdWrap { + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.login + + prefixComment = 2 | Login/Logout form: + } +} +[loginUser = *] +tt_content.login.20 { + dataArray > + dataArray { + 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.username + 10.label.wrap = | <!--###USERNAME###--> + 30.type = logintype=hidden + 30.value = logout + 40.type = submit=submit + 40.value.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.logout + } +} +[global] + + +# ****************** +# CType: splash +# ****************** +# Deprecated element. +# Still here for backwards compliance with plugins using the "text box" type. +tt_content.splash = CASE +tt_content.splash.key.field = splash_layout +tt_content.splash.stdWrap { + prefixComment = 2 | Textbox inserted (Deprecated) +} +tt_content.splash.default = COA +tt_content.splash.default { + 20 = CTABLE + 20 { + c.1 = < tt_content.text + lm.1 = IMAGE + lm.1.file { + import = uploads/pics/ + import.field = image + import.listNum = 0 + maxW.field = imagewidth + maxW.ifEmpty = 200 + } + cMargins = 30,0,0,0 + } +} +tt_content.splash.1 < tt_content.splash.default +tt_content.splash.1.20.lm.1.file > +tt_content.splash.1.20.lm.1.file = GIFBUILDER +tt_content.splash.1.20.lm.1.file { + XY = [10.w]+10,[10.h]+10 + backColor = {$content.splash.bgCol} + backColor.override.data = register:pageColor + format = jpg + 5 = BOX + 5.dimensions = 3,3,[10.w],[10.h] + 5.color = #333333 + 7 = EFFECT + 7.value = blur=99|blur=99|blur=99|blur=99|blur=99|blur=99|blur=99 + 10 = IMAGE + 10.file { + import = uploads/pics/ + import.field = image + import.listNum = 0 + maxW.field = imagewidth + maxW.ifEmpty = 200 + } +} +// The image frames are not available unless TypoScript code from styles.content.imgFrames.x is provided manually: +tt_content.splash.2 < tt_content.splash.default +#tt_content.splash.2.20.lm.1.file.m < styles.content.imgFrames.1 +tt_content.splash.3 < tt_content.splash.default +#tt_content.splash.3.20.lm.1.file.m < styles.content.imgFrames.2 + +// From plugin.postit1, if included: +tt_content.splash.20 = < plugin.postit1 + + + +# **************** +# CType: menu +# **************** +tt_content.menu = COA +tt_content.menu { + 10 = < lib.stdheader + + 20 = CASE + 20 { + key.field = menu_type + + # "Menu of these pages" + default = HMENU + default { + special = list + special.value.field = pages + wrap = <ul class="csc-menu csc-menu-def">|</ul> + 1 = TMENU + 1 { + target = {$PAGE_TARGET} + NO { + stdWrap.htmlSpecialChars = 1 + wrapItemAndSub = <li>|</li> + ATagTitle.field = description // title + } + noBlur = 1 + } + } + + # "Menu of subpages to these pages" + 1 < .default + 1 { + special = directory + wrap = <ul class="csc-menu csc-menu-1">|</ul> + } + + # "Sitemap - liststyle" + 2 = HMENU + 2 { + wrap = <div class="csc-sitemap">|</div> + 1 = TMENU + 1 { + target = {$PAGE_TARGET} + noBlur = 1 + expAll = 1 + wrap = <ul>|</ul> + NO { + stdWrap.htmlSpecialChars = 1 + wrapItemAndSub = <li>|</li> + ATagTitle.field = description // title + } + } + 2 < .1 + 3 < .1 + 4 < .1 + 5 < .1 + 6 < .1 + 7 < .1 + } + + # "Section index (pagecontent w/Index checked - liststyle)" + 3 < styles.content.get + 3 { + wrap = <ul class="csc-menu csc-menu-3">|</ul> + select.andWhere = sectionIndex!=0 + select.pidInList.override.field = pages + renderObj = TEXT + renderObj { + fieldRequired = header + trim = 1 + field = header + htmlSpecialChars = 1 + noBlur = 1 + wrap = <li class="csc-section">|</li> + typolink.parameter.field = pid + typolink.section.field = uid + } + } + + # "Menu of subpages to these pages (with abstract)" + 4 < .1 + 4 { + wrap = <dl class="csc-menu csc-menu-4">|</dl> + 1.NO { + wrapItemAndSub > + linkWrap = <dt>|</dt> + after { + data = field : abstract // field : description // field : subtitle + required = 1 + htmlSpecialChars = 1 + wrap = <dd>|</dd> + } + ATagTitle.field = description // title + } + } + + # "Recently updated pages" + 5 < .default + 5 { + wrap = <ul class="csc-menu csc-menu-5">|</ul> + special = updated + special { + maxAge = 3600*24*7 + excludeNoSearchPages = 1 + } + } + + # "Related pages (based on keywords)" + 6 < .default + 6 { + wrap = <ul class="csc-menu csc-menu-6">|</ul> + special = keywords + special { + excludeNoSearchPages = 1 + } + } + + # "Menu of subpages to these pages + sections - liststyle" + 7 < .1 + 7 { + wrap = <ul class="csc-menu csc-menu-7">|</ul> + 1.expAll = 1 + 2 < .1 + 2 { + sectionIndex = 1 + sectionIndex.type = header + wrap = <ul>|</ul> + NO.wrapItemAndSub = <li class="csc-section">|</li> + } + } + } + + 20.stdWrap { + editIcons = tt_content: menu_type, pages + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.menuSitemap + + prefixComment = 2 | Menu/Sitemap element: + } +} + + + +# **************** +# CType: shortcut +# **************** +# Should be a complete copy from the old static template "content (default)" +tt_content.shortcut = COA +tt_content.shortcut { + 20 = CASE + 20.key.field = layout + 20.0= RECORDS + 20.0 { + source.field = records + tables = {$content.shortcut.tables} + # THESE are OLD plugins. Modern plugins registers themselves automatically! + conf.tt_content = < tt_content + conf.tt_address = < tt_address + conf.tt_links = < tt_links + conf.tt_guest = < tt_guest + conf.tt_board = < tt_board + conf.tt_calender = < tt_calender + conf.tt_rating < tt_rating + conf.tt_products = < tt_products + conf.tt_news = < tt_news + conf.tt_poll = < plugin.tt_poll + } + 20.1= RECORDS + 20.1 { + source.field = records + tables = {$content.shortcut.tables} + conf.tt_poll = < plugin.tt_poll + conf.tt_poll.code = RESULT,SUBMITTEDVOTE + } + + 20.stdWrap { + editIcons = tt_content: records + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.recordList + + prefixComment = 2 | Inclusion of other records (by reference): + } +} + + +# **************** +# CType: list +# **************** +# Should be a complete copy from the old static template "content (default)" (except "lib.stdheader") +tt_content.list = COA +tt_content.list { + 10 = < lib.stdheader + + 20 = CASE + 20.key.field = list_type + 20 { + # LIST element references (NOT copy of objects!) + # THESE are OLD plugins. Modern plugins registers themselves automatically! + 3 = CASE + 3.key.field = layout + 3.0 = < plugin.tt_guest + + 4 = CASE + 4.key.field = layout + 4.0 = < plugin.tt_board_list + 4.1 = < plugin.tt_board_tree + + 2 = CASE + 2.key.field = layout + 2.0 = < plugin.tt_board_tree + + 5 = CASE + 5.key.field = layout + 5.0 = < plugin.tt_products + + 7 = CASE + 7.key.field = layout + 7.0 = < plugin.tt_calender + + 8 = CASE + 8.key.field = layout + 8.0 = < plugin.tt_rating + + 9 = CASE + 9.key.field = layout + 9.0 = < plugin.tt_news + + 11 = CASE + 11.key.field = layout + 11.0 = < plugin.tipafriend + + 20 = CASE + 20.key.field = layout + 20.0 = < plugin.feadmin.fe_users + + 21 = CASE + 21.key.field = layout + 21.0 = < plugin.feadmin.dmailsubscription + } + + 20.stdWrap { + editIcons = tt_content: list_type, layout, select_key, pages [recursive] + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.plugin + + prefixComment = 2 | Plugin inserted: + } +} + + +# **************** +# CType: script +# **************** +# OBSOLETE! Please make extensions instead. The "script" content element was meant for these custom purposes in the past. Today extensions will do the job better. +tt_content.script = TEXT +tt_content.script { + value = + + prefixComment = 2 | Script element (Deprecated) +} + + +# **************** +# CType: div +# **************** +tt_content.div = TEXT +tt_content.div { + value = <hr /> + wrap = <div class="divider">|</div> + prefixComment = 2 | Div element +} + + +# **************** +# CType: html +# **************** +# This truely IS a content object, launched from inside the PHP class of course. +# Should be a complete copy from the old static template "content (default)" +tt_content.html = TEXT +tt_content.html { + field = bodytext + + editIcons = tt_content: pages + editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.html + + prefixComment = 2 | Raw HTML content: +} + + +# **************** +# Default error msg: +# **************** +tt_content.default = TEXT +tt_content.default { + field = CType + wrap = <p style="background-color: yellow;"><b>ERROR:</b> Content Element type "|" has no rendering definition!</p> + + prefixComment = 2 | Unknown element message: +} + +# ********************************************************************* +# ACCESSIBILTY MODE +# ********************************************************************* + + + + + + + +plugin.tx_cssstyledcontent._CSS_DEFAULT_STYLE ( + /* Captions */ + DIV.csc-textpic-caption-c .csc-textpic-caption { text-align: center; } + DIV.csc-textpic-caption-r .csc-textpic-caption { text-align: right; } + DIV.csc-textpic-caption-l .csc-textpic-caption { text-align: left; } + + /* Needed for noRows setting */ + DIV.csc-textpic DIV.csc-textpic-imagecolumn { float: left; display: inline; } + + /* Border just around the image */ + {$styles.content.imgtext.borderSelector} { + border: {$styles.content.imgtext.borderThick}px solid {$styles.content.imgtext.borderColor}; + padding: {$styles.content.imgtext.borderSpace}px {$styles.content.imgtext.borderSpace}px; + } + + DIV.csc-textpic-imagewrap { padding: 0; } + + DIV.csc-textpic IMG { border: none; } + + /* DIV: This will place the images side by side */ + DIV.csc-textpic DIV.csc-textpic-imagewrap DIV.csc-textpic-image { float: left; } + + /* UL: This will place the images side by side */ + DIV.csc-textpic DIV.csc-textpic-imagewrap UL { list-style: none; margin: 0; padding: 0; } + DIV.csc-textpic DIV.csc-textpic-imagewrap UL LI { float: left; margin: 0; padding: 0; } + + /* DL: This will place the images side by side */ + DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image { float: left; } + DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image DT { float: none; } + DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image DD { float: none; } + DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image DD IMG { border: none; } /* FE-Editing Icons */ + DL.csc-textpic-image { margin: 0; } + DL.csc-textpic-image DT { margin: 0; display: inline; } + DL.csc-textpic-image DD { margin: 0; } + + /* Clearer */ + DIV.csc-textpic-clear { clear: both; } + + /* Margins around images: */ + + /* Pictures on left, add margin on right */ + DIV.csc-textpic-left DIV.csc-textpic-imagewrap .csc-textpic-image, + DIV.csc-textpic-intext-left-nowrap DIV.csc-textpic-imagewrap .csc-textpic-image, + DIV.csc-textpic-intext-left DIV.csc-textpic-imagewrap .csc-textpic-image { + display: inline; /* IE fix for double-margin bug */ + margin-right: {$styles.content.imgtext.colSpace}px; + } + + /* Pictures on right, add margin on left */ + DIV.csc-textpic-right DIV.csc-textpic-imagewrap .csc-textpic-image, + DIV.csc-textpic-intext-right-nowrap DIV.csc-textpic-imagewrap .csc-textpic-image, + DIV.csc-textpic-intext-right DIV.csc-textpic-imagewrap .csc-textpic-image { + display: inline; /* IE fix for double-margin bug */ + margin-left: {$styles.content.imgtext.colSpace}px; + } + + /* Pictures centered, add margin on left */ + DIV.csc-textpic-center DIV.csc-textpic-imagewrap .csc-textpic-image { + display: inline; /* IE fix for double-margin bug */ + margin-left: {$styles.content.imgtext.colSpace}px; + } + DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image .csc-textpic-caption { margin: 0; } + DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image IMG { margin: 0; vertical-align:bottom; } + + /* Space below each image (also in-between rows) */ + DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image { margin-bottom: {$styles.content.imgtext.rowSpace}px; } + DIV.csc-textpic-equalheight DIV.csc-textpic-imagerow { margin-bottom: {$styles.content.imgtext.rowSpace}px; display: block; } + DIV.csc-textpic DIV.csc-textpic-imagerow { clear: both; } + DIV.csc-textpic DIV.csc-textpic-single-image IMG { margin-bottom: {$styles.content.imgtext.rowSpace}px; } + + /* IE7 hack for margin between image rows */ + *+html DIV.csc-textpic DIV.csc-textpic-imagerow .csc-textpic-image { margin-bottom: 0; } + *+html DIV.csc-textpic DIV.csc-textpic-imagerow { margin-bottom: {$styles.content.imgtext.rowSpace}px; } + + /* No margins around the whole image-block */ + DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-firstcol { margin-left: 0px !important; } + DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-lastcol { margin-right: 0px !important; } + + /* Add margin from image-block to text (in case of "Text w/ images") */ + DIV.csc-textpic-intext-left DIV.csc-textpic-imagewrap, + DIV.csc-textpic-intext-left-nowrap DIV.csc-textpic-imagewrap { + margin-right: {$styles.content.imgtext.textMargin}px !important; + } + DIV.csc-textpic-intext-right DIV.csc-textpic-imagewrap, + DIV.csc-textpic-intext-right-nowrap DIV.csc-textpic-imagewrap { + margin-left: {$styles.content.imgtext.textMargin}px !important; + } + + /* Positioning of images: */ + + /* Above */ + DIV.csc-textpic-above DIV.csc-textpic-text { clear: both; } + + /* Center (above or below) */ + DIV.csc-textpic-center { text-align: center; /* IE-hack */ } + DIV.csc-textpic-center DIV.csc-textpic-imagewrap { margin: 0 auto; } + DIV.csc-textpic-center DIV.csc-textpic-imagewrap .csc-textpic-image { text-align: left; /* Remove IE-hack */ } + DIV.csc-textpic-center DIV.csc-textpic-text { text-align: left; /* Remove IE-hack */ } + + /* Right (above or below) */ + DIV.csc-textpic-right DIV.csc-textpic-imagewrap { float: right; } + DIV.csc-textpic-right DIV.csc-textpic-text { clear: right; } + + /* Left (above or below) */ + DIV.csc-textpic-left DIV.csc-textpic-imagewrap { float: left; } + DIV.csc-textpic-left DIV.csc-textpic-text { clear: left; } + + /* Left (in text) */ + DIV.csc-textpic-intext-left DIV.csc-textpic-imagewrap { float: left; } + + /* Right (in text) */ + DIV.csc-textpic-intext-right DIV.csc-textpic-imagewrap { float: right; } + + /* Right (in text, no wrap around) */ + DIV.csc-textpic-intext-right-nowrap DIV.csc-textpic-imagewrap { float: right; clear: both; } + /* Hide from IE5-mac. Only IE-win sees this. \*/ + * html DIV.csc-textpic-intext-right-nowrap .csc-textpic-text { height: 1%; } + /* End hide from IE5/mac */ + + /* Left (in text, no wrap around) */ + DIV.csc-textpic-intext-left-nowrap DIV.csc-textpic-imagewrap { float: left; clear: both; } + /* Hide from IE5-mac. Only IE-win sees this. \*/ + * html DIV.csc-textpic-intext-left-nowrap .csc-textpic-text, + * html .csc-textpic-intext-left ol, + * html .csc-textpic-intext-left ul { height: 1%; } + /* End hide from IE5/mac */ + + DIV.csc-textpic DIV.csc-textpic-imagerow-last { margin-bottom: 0; } + + /* Browser fixes: */ + + /* Fix for unordered and ordered list with image "In text, left" */ + .csc-textpic-intext-left ol, .csc-textpic-intext-left ul {padding-left: 40px; overflow: auto; } +) + +# TYPO3 SVN ID: $Id$ + diff --git a/tests/examplefiles/varnish.vcl b/tests/examplefiles/varnish.vcl new file mode 100644 index 00000000..6258c313 --- /dev/null +++ b/tests/examplefiles/varnish.vcl @@ -0,0 +1,187 @@ +# This is the VCL configuration Varnish will automatically append to your VCL +# file during compilation/loading. See the vcl(7) man page for details on syntax +# and semantics. +# New users is recommended to use the example.vcl file as a starting point. + +vcl 4.0; + +backend foo { .host = "192.168.1.1"; } + +probe blatti { .url = "foo"; } +probe fooy { + .url = "beh"; + +} + +acl foo { + "192.168.1.1"; + "192.168.0.0"/24; + ! "192.168.0.1"; +} + +include "foo.vcl"; + +import std; + +sub vcl_init { + new b = director.foo(); +} + +sub vcl_recv { + ban(req.url ~ "foo"); + rollback(); +} +sub vcl_recv { + if (req.method == "PRI") { + /* We do not support SPDY or HTTP/2.0 */ + return (synth(405)); + } + if (req.method != "GET" && + req.method != "HEAD" && + req.method != "PUT" && + req.method != "POST" && + req.method != "TRACE" && + req.method != "OPTIONS" && + req.method != "DELETE") { + /* Non-RFC2616 or CONNECT which is weird. */ + return (pipe); + } + + if (req.method != "GET" && req.method != "HEAD") { + /* We only deal with GET and HEAD by default */ + return (pass); + } + if (req.http.Authorization || req.http.Cookie) { + /* Not cacheable by default */ + return (pass); + } + return (hash); +} + +sub vcl_pipe { + # By default Connection: close is set on all piped requests, to stop + # connection reuse from sending future requests directly to the + # (potentially) wrong backend. If you do want this to happen, you can undo + # it here. + # unset bereq.http.connection; + return (pipe); +} + +sub vcl_pass { + return (fetch); +} + +sub vcl_hash { + hash_data(req.url); + if (req.http.host) { + hash_data(req.http.host); + } else { + hash_data(server.ip); + } + return (lookup); +} + +sub vcl_purge { + return (synth(200, "Purged")); +} + +sub vcl_hit { + if (obj.ttl >= 0s) { + // A pure unadultered hit, deliver it + return (deliver); + } + if (obj.ttl + obj.grace > 0s) { + // Object is in grace, deliver it + // Automatically triggers a background fetch + return (deliver); + } + // fetch & deliver once we get the result + return (miss); +} + +sub vcl_miss { + return (fetch); +} + +sub vcl_deliver { + set resp.http.x-storage = storage.s0.free; + return (deliver); +} + +/* + * We can come here "invisibly" with the following errors: 413, 417 & 503 + */ +sub vcl_synth { + set resp.http.Content-Type = "text/html; charset=utf-8"; + set resp.http.Retry-After = "5"; + synthetic( {"<!DOCTYPE html> +<html> + <head> + <title>"} + resp.status + " " + resp.reason + {"</title> + </head> + <body> + <h1>Error "} + resp.status + " " + resp.reason + {"</h1> + <p>"} + resp.reason + {"</p> + <h3>Guru Meditation:</h3> + <p>XID: "} + req.xid + {"</p> + <hr> + <p>Varnish cache server</p> + </body> +</html> +"} ); + return (deliver); +} + +####################################################################### +# Backend Fetch + +sub vcl_backend_fetch { + return (fetch); +} + +sub vcl_backend_response { + if (beresp.ttl <= 0s || + beresp.http.Set-Cookie || + beresp.http.Surrogate-control ~ "no-store" || + (!beresp.http.Surrogate-Control && + beresp.http.Cache-Control ~ "no-cache|no-store|private") || + beresp.http.Vary == "*") { + /* + * Mark as "Hit-For-Pass" for the next 2 minutes + */ + set beresp.ttl = 120s; + set beresp.uncacheable = true; + } + return (deliver); +} + +sub vcl_backend_error { + set beresp.http.Content-Type = "text/html; charset=utf-8"; + set beresp.http.Retry-After = "5"; + synthetic( {"<!DOCTYPE html> +<html> + <head> + <title>"} + beresp.status + " " + beresp.reason + {"</title> + </head> + <body> + <h1>Error "} + beresp.status + " " + beresp.reason + {"</h1> + <p>"} + beresp.reason + {"</p> + <h3>Guru Meditation:</h3> + <p>XID: "} + bereq.xid + {"</p> + <hr> + <p>Varnish cache server</p> + </body> +</html> +"} ); + return (deliver); +} + +####################################################################### +# Housekeeping + +sub vcl_init { +} + +sub vcl_fini { + return (ok); +} |