Difference between revisions of "User:Cipscis/Syntax Highlighting Test"
imported>Fceeh |
imported>Cipscis |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
This page contains an example script that contains many different elements of Papyrus for the purpose of demonstrating the wiki's syntax highlighting. I plan to use it to configure a Notepad++ user-defined language to use as close to the same styles as possible. | |||
Unfortunately, Notepad++ doesn't seem to be able to differentiate between operators and brackets in a user-defined language, yet the wiki does, so unless I'm missing something a Notepad++ user-defined language's syntax highlighting style can't be made to exactly match the wiki's style. | |||
<source lang="papyrus"> | |||
ScriptName SyntaxHighlightingTest extends Form | |||
{This script demonstrates syntax highlighting | |||
of various structures} | |||
float Property Number = 0.0 auto | |||
{This is some property documentation} | |||
bool Property Boolean = false | |||
Function Set(bool value) | |||
Boolean = value | |||
EndFunction | |||
bool Function Get() | |||
return Boolean | |||
EndFunction | |||
EndProperty | |||
string HelloWorld = "Hello, world!" ; This is a line comment | |||
ObjectReference PlayerRef | |||
int[] Array = new int[20] | |||
Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile) | |||
PlayerRef = (Game.GetPlayer() as ObjectReference) | |||
if (false != true) | |||
Boolean = !((Boolean || false) && true) | |||
Number = Number - int.Length * 1.0 | |||
Kill(Self) | |||
elseif (Game.GetPlayer as Form) | |||
; Do stuff | |||
;/ else | |||
Kill(Self) /; | |||
endif | |||
EndEvent | |||
</source> | |||
It seems the following categories are used: | |||
==Keywords== | |||
===kw1=== | |||
Keywords related to script structure e.g. <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: blue; font-weight: bold;">ScriptName extends EndFunction as endif</span> | |||
===kw2=== | |||
The names of literals e.g. <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #008040; font-weight: bold;">int bool</span> | |||
===kw3=== | |||
The names of scripts e.g. <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #008040; font-weight: bold;">ObjectReference Game Math ActiveMagicEffect</span> | |||
===kw4=== | |||
The names of property member functions: <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #6565C6; font-weight: bold;">Get Set</span> | |||
===kw5=== | |||
The names of functions, including events e.g. <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #6565C6; font-weight: bold;">GetPlayer OnHit</span> | |||
==Comments== | |||
===coMULTI=== | |||
Documentation comments surrounded by curly braces: <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #8E8E8E; font-style: italic;"><nowiki>{This is a comment}</nowiki></span> | |||
Multi-line comments delimited by ";/" and "/;": <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #8E8E8E; font-style: italic;"><nowiki>;/ This is a comment ;/</nowiki></span> | |||
===co1=== | |||
Line comments preceded by a semi-colon (semi-colons inside string literals don't count): <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #8E8E8E; font-style: italic;">; This is a comment</span> | |||
==Strings== | |||
===st0=== | |||
Strings surrounded by double quotes: <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #A82800;">"This is a string"</span> | |||
==Symbols== | |||
===sy0=== | |||
Operators such as the following: <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #0080FF; font-weight: bold;">+ - = += && || . ,</span> | |||
==Brackets== | |||
===br0=== | |||
Brackets such as the following: <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: black;">( ) [ ]</span> | |||
==Numbers== | |||
===nu0=== | |||
Numbers, including decimal points: <span style="padding: 4px; border: 1px dashed #2F6FAB; background-color: #F9F9F9; font-family: monospace; font-size: 1.2em; color: #FF0080; font-weight: bold;">1 9 3.0 2.5</span> | |||
Latest revision as of 00:43, 15 December 2012
This page contains an example script that contains many different elements of Papyrus for the purpose of demonstrating the wiki's syntax highlighting. I plan to use it to configure a Notepad++ user-defined language to use as close to the same styles as possible.
Unfortunately, Notepad++ doesn't seem to be able to differentiate between operators and brackets in a user-defined language, yet the wiki does, so unless I'm missing something a Notepad++ user-defined language's syntax highlighting style can't be made to exactly match the wiki's style.
ScriptName SyntaxHighlightingTest extends Form
{This script demonstrates syntax highlighting
of various structures}
float Property Number = 0.0 auto
{This is some property documentation}
bool Property Boolean = false
Function Set(bool value)
Boolean = value
EndFunction
bool Function Get()
return Boolean
EndFunction
EndProperty
string HelloWorld = "Hello, world!" ; This is a line comment
ObjectReference PlayerRef
int[] Array = new int[20]
Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)
PlayerRef = (Game.GetPlayer() as ObjectReference)
if (false != true)
Boolean = !((Boolean || false) && true)
Number = Number - int.Length * 1.0
Kill(Self)
elseif (Game.GetPlayer as Form)
; Do stuff
;/ else
Kill(Self) /;
endif
EndEvent
It seems the following categories are used:
Keywords[edit | edit source]
kw1[edit | edit source]
Keywords related to script structure e.g. ScriptName extends EndFunction as endif
kw2[edit | edit source]
The names of literals e.g. int bool
kw3[edit | edit source]
The names of scripts e.g. ObjectReference Game Math ActiveMagicEffect
kw4[edit | edit source]
The names of property member functions: Get Set
kw5[edit | edit source]
The names of functions, including events e.g. GetPlayer OnHit
Comments[edit | edit source]
coMULTI[edit | edit source]
Documentation comments surrounded by curly braces: {This is a comment}
Multi-line comments delimited by ";/" and "/;": ;/ This is a comment ;/
co1[edit | edit source]
Line comments preceded by a semi-colon (semi-colons inside string literals don't count): ; This is a comment
Strings[edit | edit source]
st0[edit | edit source]
Strings surrounded by double quotes: "This is a string"
Symbols[edit | edit source]
sy0[edit | edit source]
Operators such as the following: + - = += && || . ,
Brackets[edit | edit source]
br0[edit | edit source]
Brackets such as the following: ( ) [ ]
Numbers[edit | edit source]
nu0[edit | edit source]
Numbers, including decimal points: 1 9 3.0 2.5