blob: c11f3f9c27c36b25ba522ac6914b7f393a357cac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
"=============================================================================
" File: after/syntax/robot.vim
" Author: Michael Foukarakis
" Version: 0.1
" Created: Fri 17 Dec 2010 11:31:46 AM EET
" Last Update: Wed Dec 10, 2014 12:39 EET
"------------------------------------------------------------------------
" Description:
" Syntax file for Robot test framework files.
"
"------------------------------------------------------------------------
" Installation:
" Drop this file into {rtp}/after/syntax
" Requires Vim 7+
" History:
" 0.1 - Robot now has a standard library, containing all sorts of goodies.
" TODO:
" * Links look OK in most of my colorschemes, but your opinions are
" more than welcome.
" * Fix word boundaries for numbers.
" * Figure out a neater alternative for the monster path regex
" * Robot has no syntax spec :(
"=============================================================================
let s:cpo_save=&cpo
set cpo&vim
"------------------------------------------------------------------------
" Matches
"------------------------------------------------------------------------
syn match robotNumber display "\<\d\+\>"
syn match robotEllipsis display "\.\.\."
" Special (escaped) character as defined in Robot's syntax.
syn match robotSpecial display "\\\(\${.*}\|\\\|#\|[n|r|t]\)"
" As variables may be used next to each other, do a non-greedy match.
" Alternatively, match only alphanumeric chars inside brackets.
syn match robotVariable "\(\$\|@\){.\{-}}"
" This is actually NSN specific, keep/change/delete it at will.
" syn match robotTestCaseName "^NG\d\+[ \|\n\|\t]"
" This is by far the most stupid regex you'll see in here..
syn match robotPath display "\(\.\{1,2}\/\)\=\(\(\h\|\d\)\+\/\)\+\(\(\h\|\d\)\+\.\h\+\)\{,1}$"
" Operators
syn match robotOperator "==\|="
" Table headers
syn match robotTable "\c^\(\*\+\)\s*\(settings\|variables\|test cases\|\(user \)\?keywords\)\s*\1$"
" Builtins
syn match robotBuiltin "\c\<\(Call Method\|Catenate\|Comment\>\|Convert To Boolean\|Convert To Integer\|Convert To Number\|Convert To String\|Create List\|Evaluate\|Exit For Loop\|Fail\>\|Fatal Error\|Get Count\>\|Get Length\|Get Library Instance\|Get Time\|Get Variables\|Import Library\|Import Resource\|Import Variables\|Length Should Be\|Log Many\|Log Variables\|Log\|No Operation\|Regexp Escape\|Remove Tags\|Repeat Keyword\|Replace Variables\|Run Keyword And Continue On Failure\|Run Keyword And Expect Error\|Run Keyword And Ignore Error\|Run Keyword If All Critical Tests Passed\|Run Keyword If All Tests Passed\|Run Keyword If Any Critical Tests Failed\|Run Keyword If Any Tests Failed\|Run Keyword If Test Failed\|Run Keyword If Test Passed\|Run Keyword If Timeout Occurred\|Run Keyword If\|Run Keyword Unless\|Run Keywords\|Run Keyword\|Set Global Variable\|Set Library Search Order\|Set Log Level\|Set Suite Variable\|Set Tags\|Set Test Message\|Set Test Variable\|Set Variable If\|Set Variable\|Should Be Empty\|Should Be Equal As Integers\|Should Be Equal As Numbers\|Should Be Equal As Strings\|Should Be Equal\|Should Be True\|Should Contain X Times\|Should Contain\|Should End With\|Should Match Regexp\|Should Match\|Should Not Be Empty\|Should Not Be Equal As Integers\|Should Not Be Equal As Numbers\|Should Not Be Equal As Strings\|Should Not Be Equal\|Should Not Be True\|Should Not Contain\|Should Not End With\|Should Not Match Regexp\|Should Not Match\|Should Not Start With\|Should Start With\|Sleep\|Variable Should Exist\|Variable Should Not Exist\|Wait Until Keyword Succeeds\)\>"
" Common settings
syn match robotCommonSet "\c\[\(Documentation\|Timeout\)\]"
" Keyword settings
syn match robotKeywordSet "\c\[\(Arguments\|Return\)\]"
" Testcase settings
syn match robotTestcaseSet "\c\[\(Tags\|Setup\|Teardown\|Precondition\|Postcondition\|Template\)\]"
" Robot Gherkin support
syn match robotGherkin "\c\<\(Given\|When\|Then\|And\|But\)\>"
" Settings (global)
syn match robotSetup "\c\(Suite\|Test\) \(Setup\|Teardown\|Precondition\|Postcondition\)"
syn match robotSettings "\c\<\(Library\|Resource\|Variables\|Documentation\|Metadata\|Force Tags\|Default Tags\|Test Template\|Test Timeout\)\>"
" Standard library
syn match robotStdlib "\c\(Replace String\|Replace String Using Regexp\)" " TODO
" Other libraries (Selenium)
syn match seleniumLibrary "\c\<\(Add Location Strategy\|Alert Should Be Present\|Assign Id To Element\|Call Selenium Api\|Capture Page Screenshot\|Capture Screenshot\|Checkbox Should Be Selected\|Checkbox Should Not Be Selected\|Choose Cancel On Next Confirmation\|Choose File\|Click Button\|Click Element\|Click Flex Element\|Click Image\|Click Link\|Close All Browsers\|Close Browser\|Close Window\|Confirm Action\|Current Frame Contains\|Current Frame Should Contain\|Delete All Cookies\|Delete Cookie\|Double Click Element\|Double Click Flex Element\|Drag And Drop\|Element Should Be Disabled\|Element Should Be Enabled\|Element Should Be Visible\|Element Should Contain\|Element Should Not Be Visible\|Element Text Should Be\|Execute Javascript\|Flex Element Property Should Be\|Flex Element Should Exist\|Flex Element Should Not Exist\|Flex Element Text Should Be\|Focus\|Frame Should Contain Text\|Frame Should Contain\|Get Alert Message\|Get All Links\|Get Cookie Value\|Get Cookies\|Get Element Attribute\|Get Horizontal Position\|Get List Items\|Get Location\|Get Matching Xpath Count\|Get Source\|Get Table Cell\|Get Text\|Get Title\|Get Value\|Get Vertical Position\|Get Window Identifiers\|Get Window Names\|Get Window Titles\|Go Back\|Go To\|Input Password\|Input Text Into Flex Element\|Input Text\|List Selection Should Be\|List Should Have No Selections\|Location Should Be\|Location Should Contain\|Log Source\|Maximize Browser Window\|Mouse Down On Image\|Mouse Down On Link\|Mouse Down\|Mouse Out\|Mouse Over\|Mouse Up\|Open Browser\|Open Context Menu\|Page Should Contain Button\|Page Should Contain Checkbox\|Page Should Contain Element\|Page Should Contain Image\|Page Should Contain Link\|Page Should Contain List\|Page Should Contain Radio Button\|Page Should Contain Textfield\|Page Should Contain\|Page Should Not Contain Button\|Page Should Not Contain Checkbox\|Page Should Not Contain Element\|Page Should Not Contain Image\|Page Should Not Contain Link\|Page Should Not Contain List\|Page Should Not Contain Radio Button\|Page Should Not Contain Textfield\|Page Should Not Contain\|Press Key Native\|Press Key\|Radio Button Should Be Set To\|Radio Button Should Not Be Selected\|Register Keyword To Run On Failure\|Reload Page\|Select All From List\|Select Checkbox\|Select Flex Application\|Select Frame\|Select From Flex Element\|Select From List\|Select Radio Button\|Select Window\|Set Selenium Speed\|Set Selenium Timeout\|Simulate\|Start Selenium Server\|Stop Selenium Server\|Submit Form\|Switch Browser\|Table Cell Should Contain\|Table Column Should Contain\|Table Footer Should Contain\|Table Header Should Contain\|Table Row Should Contain\|Table Should Contain\|Textfield Should Contain\|Textfield Value Should Be\|Title Should Be\|Unselect Checkbox\|Unselect Frame\|Unselect From List\|Wait For Condition\|Wait For Flex Element\|Wait Until Page Contains Element\|Wait Until Page Contains\|Wait Until Page Loaded\|Xpath Should Match X Times\)\>"
"------------------------------------------------------------------------
" Regions
"------------------------------------------------------------------------
" Single-line comments. Are there multi-line comments?
syn region robotComment display start="^#" excludenl end="$"
syn region robotString start="\"" excludenl end="\""
"------------------------------------------------------------------------
" Keywords
"------------------------------------------------------------------------
"------------------------------------------------------------------------
" Links
"------------------------------------------------------------------------
hi def link robotVariable Type
hi def link robotSetup Include
hi def link robotSettings Include
hi def link robotTestCaseName Function
hi def link robotComment Comment
hi def link robotEllipsis String
hi def link robotTable Identifier
hi def link robotImport Include
hi def link robotSpecial Special
hi def link robotString String
hi def link robotNumber Number
hi def link robotPath Constant
hi def link robotOperator Operator
hi def link robotBuiltin Comment
hi def link robotCommonSet Keyword
hi def link robotKeywordSet Keyword
hi def link robotTestcaseSet Keyword
hi def link robotGherkin Keyword
hi def link seleniumLibrary Keyword
let b:current_syntax = "robot"
"------------------------------------------------------------------------
let &cpo=s:cpo_save
" vim600: set fdm=marker:
|