"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "langDefs/polygen.lang" between
highlight-3.53.tar.bz2 and highlight-3.54.tar.bz2

About: highlight converts source code to formatted text with syntax highlighting (for e.g. to HTML, XHTML, RTF, TeX, LaTeX, SVG, BBCode and XML format).

polygen.lang  (highlight-3.53.tar.bz2):polygen.lang  (highlight-3.54.tar.bz2)
* --[[
* ********************************************************************************
* Polygen Grammars Syntax Definition * *
* * Polygen Grammars Syntax Definition *
* * *
* * v1.0.1 (2018/01/18) | Highlight v3.41 | Lua 5.3 *
* v1.0.1 (2018/01/18) | Highlight v3.41 | Lua 5.3 * *
* * by Tristano Ajmone *
* * *
* ********************************************************************************
* by Tristano Ajmone Associated file extensions: ".grm"
* Syntax type: EBNF
* --------------------------------------------------------------------------------
* Polygen is a cross-platform command line tool for generating random sentences
**************************************************************************** according to a grammar definition -- ie: following custom syntactical and
* lexical rules. It takes an Ascii text file ("*.grm") as source program defining
Associated file extensions: ".grm" a grammar by means of EBNF-like probabilistic rules and executes it. At each
Syntax type: EBNF execution, the grammar will be run against different random seeds, therefore
---------------------------------------------------------------------------- producing a different text output.
-
Polygen is a cross-platform command line tool for generating random sentence The main goal of Polygen is to generate cursory nonsense for entertainment;
s or, in the words of its author, "a first effort towards satyre in computer
according to a grammar definition -- ie: following custom syntactical and science". Polygen was created by Alvise Spanò.
lexical rules. It takes an Ascii text file ("*.grm") as source program defin
ing Polygen Website and GitHub repository:
a grammar by means of EBNF-like probabilistic rules and executes it. At each http://www.polygen.org/
execution, the grammar will be run against different random seeds, therefore https://github.com/alvisespano/Polygen
producing a different text output.
Polygen grammars documentation (in Italian):
The main goal of Polygen is to generate cursory nonsense for entertainment; http://www.polygen.org/it/manuale
or, in the words of its author, "a first effort towards satyre in computer
science". Polygen was created by Alvise Spanò. An outdated English translation (probably from an earlier version of Polygen,
since it doesn't cover the full syntax) can be found at:
Polygen Website and GitHub repository: http://lapo.it/polygen/polygen-1.0.6-20040705-doc.zip
http://www.polygen.org/ --------------------------------------------------------------------------------
https://github.com/alvisespano/Polygen Written by Tristano Ajmone:
<tajmone@gmail.com>
Polygen grammars documentation (in Italian): https://github.com/tajmone
http://www.polygen.org/it/manuale Released into the public domain according to the Unlicense terms:
http://unlicense.org/
An outdated English translation (probably from an earlier version of Polygen --------------------------------------------------------------------------------
,
since it doesn't cover the full syntax) can be found at:
http://lapo.it/polygen/polygen-1.0.6-20040705-doc.zip
----------------------------------------------------------------------------
-
Written by Tristano Ajmone:
<tajmone@gmail.com>
https://github.com/tajmone
Released into the public domain according to the Unlicense terms:
http://unlicense.org/
----------------------------------------------------------------------------
-
--]] --]]
Description="Polygen" Description="Polygen"
Categories = {"source", "script"} Categories = {"source", "script"}
IgnoreCase=false IgnoreCase=false
EnableIndentation=false EnableIndentation=false
-------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -
-- DISABLE/OVERRIDE UNUSED SYNTAX ELEMENTS -- DISABLE/OVERRIDE UNUSED SYNTAX ELEMENTS
-------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -
skipping to change at line 75 skipping to change at line 76
-- OCaml style comments, no nesting: (* ...COMMENT BLOCK... *) -- OCaml style comments, no nesting: (* ...COMMENT BLOCK... *)
Comments={ Comments={
{ Block=true, { Block=true,
Nested=false, Nested=false,
Delimiter = { Delimiter = {
[=[ \(\* ]=], -- Comment start: '(*' [=[ \(\* ]=], -- Comment start: '(*'
[=[ \*\) ]=] -- Comment end: '*)' [=[ \*\) ]=] -- Comment end: '*)'
} }
}, },
} }
-- =============================================================================
-- STRINGS -- STRINGS
-- =============================================================================
Strings={ Strings={
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
-- STRING DELIMITERS -- STRING DELIMITERS
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
-- Polygen reckognises only double quotes as string delimiter: "...STRING..." -- Polygen reckognises only double quotes as string delimiter: "...STRING..."
Delimiter=[=[ " ]=], Delimiter=[=[ " ]=],
--[[----------------------------------------------------------------------------
ESCAPE SEQUENCES ESCAPE SEQUENCES
----------------------------------------------------------------------------- ----------------------------------------------------------------------------
- Escape sequences can occur only inside strings -- here enforced via a custom
Escape sequences can occur only inside strings -- here enforced via a custom OnStateChange() hook-function, further on. Valid escape sequences:
OnStateChange() hook-function, further on. Valid escape sequences:
\\ Backslash \\ Backslash
\" Quote \" Quote
\n New line \n New line
\r Carriage return \r Carriage return
\b Backspace \b Backspace
\t Tab \t Tab
\nnn ASCII decimal code (must always be three digits) --] ] \nnn ASCII decimal code (must always be three digits) --] ]
Escape=[=[ \\\d{3}|\\[nrbt\\"] ]=], Escape=[=[ \\\d{3}|\\[nrbt\\"] ]=],
} }
OPERATORS --[[============================================================================
============================================================================ OPERATORS
= ============================================================================
::= := : ; ^ . , _ | + - > < \ ::= := : ; ^ . , _ | + - > < \
>> << ( ) [ ] { } >> << ( ) [ ] { }
--]] --]]
Operators=[=[ ::?=|\^|\.|:|\+|-|>|<|\(|\)|\[|]|\{|}|\||,|;|_|\\ ]=] Operators=[=[ ::?=|\^|\.|:|\+|-|>|<|\(|\)|\[|]|\{|}|\||,|;|_|\\ ]=]
-- =============================================================================
-- KEYWORDS -- KEYWORDS
-- =============================================================================
Keywords={ Keywords={
-- KNOWN ISSUES: An unspaced non-terminal symbol definition will be parsed as -- KNOWN ISSUES: An unspaced non-terminal symbol definition will be parsed as
-- as a label (eg: 'S::=` and 'X:=`, instead of 'S ::=` and 'X :=`) because of -- as a label (eg: 'S::=` and 'X:=`, instead of 'S ::=` and 'X :=`) because of
-- the colon; and a label with spaces before the colon will be parsed as a non - -- the colon; and a label with spaces before the colon will be parsed as a non -
-- terminal symbol (eg: 'Label :' instead of 'Label:'). Since both usages are -- terminal symbol (eg: 'Label :' instead of 'Label:'). Since both usages are
-- considered bad (albeit valid) styles in Polygen grammars (and indeed are -- considered bad (albeit valid) styles in Polygen grammars (and indeed are
-- rarely found in actual gramamrs), it's not worth implementing complex RegEx s -- rarely found in actual gramamrs), it's not worth implementing complex RegEx s
-- to capture such edge cases. -- to capture such edge cases.
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
-- Non-Terminal Symbol -- Non-Terminal Symbol
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
{ Id=1, { Id=1,
Regex=[=[ (?<!\.)([A-Z][A-Za-z0-9]*)\b(?!:) ]=], Regex=[=[ (?<!\.)([A-Z][A-Za-z0-9]*)\b(?!:) ]=],
Group=1 Group=1
}, },
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
-- Label Identifier -- Label Identifier
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
- -- Captures a label identifier at definition time: LABEL: <..definition...>
-- Captures a label identifier at definition time: LABEL: <..definition...
>
{ Id=2, { Id=2,
Regex=[=[ ([A-Za-z0-9]+)(?::) ]=], Regex=[=[ ([A-Za-z0-9]+)(?::) ]=],
Group=1 Group=1
}, },
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
-- Label Selector -- Label Selector
------------------------------------------------------------------------------ - ------------------------------------------------------------------------------
-- Either a dot followed by a single Label or by a group of labels within roun d -- Either a dot followed by a single Label or by a group of labels within roun d
-- brackets: .LABEL .(LABEL1|LABEL2) .(++LABEL1|-LABEL2) -- brackets: .LABEL .(LABEL1|LABEL2) .(++LABEL1|-LABEL2)
-- The dot selector is excluded from the match; the whole bracketed group will -- The dot selector is excluded from the match; the whole bracketed group will
-- be treated as a single keyword (as in PolyGUI tool). -- be treated as a single keyword (as in PolyGUI tool).
{ Id=3, { Id=3,
Regex=[=[ (?:\.)(\(.*?\)|[A-Za-z0-9]+) ]=], Regex=[=[ (?:\.)(\(.*?\)|[A-Za-z0-9]+) ]=],
Group=1 Group=1
}, },
} }
-- *****************************************************************************
-- * *
-- * CUSTOM HOOK-FUNCTIONS *
-- * *
-- *****************************************************************************
-- =============================================================================
-- Escape Sequences Only Inside String
-- =============================================================================
function OnStateChange(oldState, newState, token, kwgroup) function OnStateChange(oldState, newState, token, kwgroup)
-- This function ensures that escape sequences outside strings are ignored. -- This function ensures that escape sequences outside strings are ignored.
-- Based on André Simon's reply to Issue #23: -- Based on André Simon's reply to Issue #23:
-- https://github.com/andre-simon/highlight/issues/23#issuecomment-332002639 -- https://github.com/andre-simon/highlight/issues/23#issuecomment-332002639
if newState==HL_ESC_SEQ and oldState~=HL_STRING then if newState==HL_ESC_SEQ and oldState~=HL_STRING then
return HL_STANDARD return HL_STANDARD
end end
return newState return newState
end end
CHANGELOG --[[============================================================================
================================================================================ CHANGELOG
== ================================================================================
v1.0.1 (2018/01/18) | Highlight v3.41) v1.0.1 (2018/01/18) | Highlight v3.41)
- Changed "PolyGen" to "Polygen" (the author has now officially adopted the - Changed "PolyGen" to "Polygen" (the author has now officially adopted the
latter syntax). latter syntax).
v1.0.0 (2018/01/04) | Highlight v3.41) v1.0.0 (2018/01/04) | Highlight v3.41)
- First release. - First release.
--]] --]]
 End of changes. 18 change blocks. 
80 lines changed or deleted 78 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)