mirror of
https://github.com/zoriya/vim.git
synced 2025-12-28 18:08:18 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
335e0b6974 | ||
|
|
4d1da49cfe | ||
|
|
7a26dd860a | ||
|
|
af6abb9d93 | ||
|
|
3f99152276 | ||
|
|
b70a473e24 | ||
|
|
3bb28557e1 | ||
|
|
a8565fecc6 | ||
|
|
4c7e9db0d6 | ||
|
|
687a29c5e2 | ||
|
|
f6dcbb245b | ||
|
|
f8de161090 | ||
|
|
54c34fa6f5 | ||
|
|
768baacdc8 | ||
|
|
b376647bb1 | ||
|
|
332ac0621c | ||
|
|
84b0493c34 | ||
|
|
429fa85392 | ||
|
|
07219f911c | ||
|
|
6f852a557d | ||
|
|
7311c6932c | ||
|
|
0bcdd6e709 | ||
|
|
0187ca0bdf | ||
|
|
38ec50bea8 | ||
|
|
e3e6e573d1 | ||
|
|
8185111125 | ||
|
|
644cf03b7e | ||
|
|
126bdeeabe | ||
|
|
2a66a07b29 |
@@ -1,4 +1,4 @@
|
||||
*insert.txt* For Vim version 7.3. Last change: 2013 Jan 09
|
||||
*insert.txt* For Vim version 7.3. Last change: 2013 Apr 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1869,13 +1869,15 @@ NOTE: These commands cannot be used with |:global| or |:vglobal|.
|
||||
See |++opt| for the possible values of [++opt].
|
||||
|
||||
*:r!* *:read!*
|
||||
:[range]r[ead] !{cmd} Execute {cmd} and insert its standard output below
|
||||
:[range]r[ead] [++opt] !{cmd}
|
||||
Execute {cmd} and insert its standard output below
|
||||
the cursor or the specified line. A temporary file is
|
||||
used to store the output of the command which is then
|
||||
read into the buffer. 'shellredir' is used to save
|
||||
the output of the command, which can be set to include
|
||||
stderr or not. {cmd} is executed like with ":!{cmd}",
|
||||
any '!' is replaced with the previous command |:!|.
|
||||
See |++opt| for the possible values of [++opt].
|
||||
|
||||
These commands insert the contents of a file, or the output of a command,
|
||||
into the buffer. They can be undone. They cannot be repeated with the "."
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.3. Last change: 2013 Apr 05
|
||||
*todo.txt* For Vim version 7.3. Last change: 2013 Apr 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -41,8 +41,6 @@ Go through more coverity reports.
|
||||
|
||||
Valgrind errors in test 16.
|
||||
|
||||
Memory leaks in Lua, uncovered by test 85.
|
||||
|
||||
Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10)
|
||||
|
||||
Checking runtime scripts: Thilo Six, 2012 Jun 6.
|
||||
@@ -56,9 +54,6 @@ The CompleteDone autocommand needs some info passed to it:
|
||||
- The word that was selected (empty if abandoned complete)
|
||||
- Type of completion: tag, omnifunc, user func.
|
||||
|
||||
Patch to fix sorting order when 'fileignorecase' is set. (Hirohito Higashi,
|
||||
2013 Mar 20) Update Mar 24.
|
||||
|
||||
Using ":call foo#d.f()" doesn't autoload the "foo.vim" file.
|
||||
That is, calling a dictionary function on an autoloaded dict.
|
||||
Works OK for echo, just not for ":call" and ":call call()". (Ted, 2011 Mar
|
||||
@@ -75,9 +70,6 @@ Stocker, 2012 Jan 5)
|
||||
Patch to avoid that visul motion breaks repeat with ".". (Sung Pae, 2013 Mar
|
||||
25)
|
||||
|
||||
Patch to fix problem introduced by 7.3.859, reusing "p". (Christian Brabandt,
|
||||
2013 Mar 20)
|
||||
|
||||
Problem caused by patch 7.3.638: window->open does not update window
|
||||
correctly. Issue 91.
|
||||
|
||||
@@ -143,8 +135,15 @@ MS-Windows: Crash opening very long file name starting with "\\".
|
||||
It's probably a good idea to make a negative value for 'sts' use the value of
|
||||
'sw'. Patch by So8res, Oct 3 2012
|
||||
|
||||
Test 79 fails on Windows only. (Michael Soyka, 2013 Apr 11).
|
||||
What makes the test script mapping continue after an error?
|
||||
|
||||
patch to add "combine" flag to syntax commands. (so8res, 2012 Dec 6)
|
||||
|
||||
Combining characters are not used when executing a register with :@w.
|
||||
(William Fugh, 2013 Apr 5, more info from Ben Fritz)
|
||||
Patch by Christian Brabandt, 2013 Apr 6. Second one.
|
||||
|
||||
Bug in completion menu. (Olivier Teuliere, 2013 Feb 15)
|
||||
Patch by Christian Brabandt, Feb 16.
|
||||
|
||||
@@ -228,9 +227,6 @@ URXVT:
|
||||
|
||||
MS-Windows: test 17 fails. Analysis by Michael Soyka, 2012 Nov 5.
|
||||
|
||||
Combining characters are not used when executing a register with :@w.
|
||||
(William Fugh, 2013 Apr 5, more info from Ben Fritz)
|
||||
|
||||
Patch to add tests for if_xcmdsrv.c., Jul 8, need some more work. (Brian Burns)
|
||||
New tests Jul 13. Update Jul 17. Discussion Jul 18.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2013 Apr 05
|
||||
" Last Change: 2013 Apr 08
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
@@ -1638,9 +1638,6 @@ func! s:FTr()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" ReDIF
|
||||
au BufRead,BufNewFile *.rdf setf redif
|
||||
|
||||
" Remind
|
||||
au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind
|
||||
|
||||
@@ -2566,6 +2563,20 @@ au BufNewFile,BufRead *termcap*
|
||||
\| let b:ptcap_type = "term" | call s:StarSetf('ptcap')
|
||||
\|endif
|
||||
|
||||
" ReDIF
|
||||
" Only used when the .rdf file was not detected to be XML.
|
||||
au BufRead,BufNewFile *.rdf call s:Redif()
|
||||
func! s:Redif()
|
||||
let lnum = 1
|
||||
while lnum <= 5 && lnum < line('$')
|
||||
if getline(lnum) =~ "^\ctemplate-type:"
|
||||
setf redif
|
||||
return
|
||||
endif
|
||||
let lnum = lnum + 1
|
||||
endwhile
|
||||
endfunc
|
||||
|
||||
" Remind
|
||||
au BufNewFile,BufRead .reminders* call s:StarSetf('remind')
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: Vim help file
|
||||
" Maintainer: Bram Moolenaar (Bram@vim.org)
|
||||
" Last Change: 2012 Jul 16
|
||||
" Last Change: 2013 Apr 07
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -40,7 +40,7 @@ syn match helpVim "Vim version [0-9.a-z]\+"
|
||||
syn match helpVim "VIM REFERENCE.*"
|
||||
syn match helpOption "'[a-z]\{2,\}'"
|
||||
syn match helpOption "'t_..'"
|
||||
syn match helpCommand "`[^` ]*`"hs=s+1,he=e-1 contains=helpBacktick
|
||||
syn match helpCommand "`[^` ]\+`"hs=s+1,he=e-1 contains=helpBacktick
|
||||
syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
|
||||
syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
|
||||
if has("conceal")
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
" ninja build file syntax.
|
||||
" Language: ninja build file as described at
|
||||
" http://martine.github.com/ninja/manual.html
|
||||
" Version: 1.2
|
||||
" Last Change: 2012/06/01
|
||||
" Version: 1.3
|
||||
" Last Change: 2013 Apr 12
|
||||
" Maintainer: Nicolas Weber <nicolasweber@gmx.de>
|
||||
|
||||
" ninja lexer and parser are at
|
||||
" https://github.com/martine/ninja/blob/master/src/lexer.in.cc
|
||||
" https://github.com/martine/ninja/blob/master/src/parsers.cc
|
||||
" https://github.com/martine/ninja/blob/master/src/manifest_parser.cc
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -19,9 +19,10 @@ syn match ninjaComment /#.*/ contains=@Spell
|
||||
|
||||
" Toplevel statements are the ones listed here and
|
||||
" toplevel variable assignments (ident '=' value).
|
||||
" lexer.in.cc, ReadToken() and parsers.cc, Parse()
|
||||
" lexer.in.cc, ReadToken() and manifest_parser.cc, Parse()
|
||||
syn match ninjaKeyword "^build\>"
|
||||
syn match ninjaKeyword "^rule\>"
|
||||
syn match ninjaKeyword "^pool\>"
|
||||
syn match ninjaKeyword "^default\>"
|
||||
syn match ninjaKeyword "^include\>"
|
||||
syn match ninjaKeyword "^subninja\>"
|
||||
@@ -30,9 +31,12 @@ syn match ninjaKeyword "^subninja\>"
|
||||
" on the first line without indent. 'rule' allows only a
|
||||
" limited set of magic variables, 'build' allows general
|
||||
" let assignments.
|
||||
" parsers.cc, ParseRule()
|
||||
" manifest_parser.cc, ParseRule()
|
||||
syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent
|
||||
syn keyword ninjaRuleCommand contained command depfile description generator restat
|
||||
syn keyword ninjaRuleCommand contained command deps depfile description generator pool restat rspfile rspfile_content
|
||||
|
||||
syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent
|
||||
syn keyword ninjaPoolCommand contained depth
|
||||
|
||||
" Strings are parsed as follows:
|
||||
" lexer.in.cc, ReadEvalString()
|
||||
@@ -58,6 +62,7 @@ syn match ninjaOperator "\(=\|:\||\|||\)\ze\s"
|
||||
hi def link ninjaComment Comment
|
||||
hi def link ninjaKeyword Keyword
|
||||
hi def link ninjaRuleCommand Statement
|
||||
hi def link ninjaPoolCommand Statement
|
||||
hi def link ninjaWrapLineOperator ninjaOperator
|
||||
hi def link ninjaOperator Operator
|
||||
hi def link ninjaSimpleVar ninjaVar
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
" Vim syntax file
|
||||
" Language: ReDIF
|
||||
" Maintainer: Axel Castellane <axel.castellane@polytechnique.edu>
|
||||
" Last Change: 2013 Feb 20
|
||||
" Last Change: 2013 April 08
|
||||
" Original Author: Axel Castellane
|
||||
" Source: http://openlib.org/acmes/root/docu/redif_1.html
|
||||
" File Extension: rdf
|
||||
" Note: The ReDIF format is used by RePEc.
|
||||
|
||||
" Start with a check for "b:current_syntax". If it is defined, some other
|
||||
" syntax file, earlier in 'runtimepath' was already loaded:
|
||||
if exists("b:current_syntax")
|
||||
" To be compatible with Vim 5.8 use:
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Sync: The template-type (ReDIF-Paper, ReDIF-Archive, etc.) influences which
|
||||
" fields can follow. Thus sync must start from the beginning to know which
|
||||
" fields are right or wrong.
|
||||
syntax sync fromstart
|
||||
|
||||
" ReDIF is case-insensitive
|
||||
syntax case ignore
|
||||
|
||||
@@ -27,61 +24,80 @@ syntax case ignore
|
||||
" *-Institution
|
||||
" Those fields span a syntax region over several lines so that these regions
|
||||
" can only contain their respective items.
|
||||
"
|
||||
" Other fields (except comments) can only happen in one of these regions.
|
||||
|
||||
" Comments must start with # as the first character of the line, otherwise
|
||||
" I believe that they are considered as part of an argument.
|
||||
syntax region redifComment start=/^#/ end=/$/ containedin=ALL display
|
||||
" Any line which is not a correct template or part of an argument is an error.
|
||||
" This comes at the very beginning, so it has the lowest priority and will
|
||||
" only match if nothing else did.
|
||||
syntax match redifWrongLine /^.\+/ display
|
||||
|
||||
" Beginning: Anything which is not a comment is not allowed before a
|
||||
" "Template-Type:" statement. However, not to trouble the users when beginning
|
||||
" writing a Template-Type, this are not highlighted as errors.
|
||||
syntax region redifIncorrectBeginningOfFile start=/\%^/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifComment,redifBeginningOfCorrectTemplateType,redifFieldTemplateType
|
||||
syntax match redifBeginningOfCorrectTemplateType /^\cT\%[emplate-Type:]$/ display
|
||||
highlight def link redifWrongLine redifError
|
||||
|
||||
highlight def link redifIncorrectBeginningOfFile redifError
|
||||
" Comments must start with # and it must be the first character of the line,
|
||||
" otherwise I believe that they are considered as part of an argument.
|
||||
syntax match redifComment /^#.*/ containedin=ALL display
|
||||
|
||||
" Defines the 9 possible multi-lines regions of Template-Type and the fields
|
||||
" they can contain.
|
||||
syntax region redifRegionTemplatePaper start=/^Template-Type:\_s*ReDIF-Paper \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterAuthor,redifRegionClusterFile,redifFieldTitle,redifFieldHandleOfWork,redifFieldLanguage,redifFieldContactEmail,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldNumber,redifFieldCreationDate,redifFieldRevisionDate,redifFieldPublicationStatus,redifFieldNote,redifFieldLength,redifFieldSeries,redifFieldAvailability,redifFieldOrderURL,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldRestriction,redifFieldPrice,redifFieldNotification,redifFieldPublicationType,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateArticle start=/^Template-Type:\_s*ReDIF-Article \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterAuthor,redifRegionClusterFile,redifFieldTitle,redifFieldHandleOfWork,redifFieldLanguage,redifFieldContactEmail,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldNumber,redifFieldCreationDate,redifFieldPublicationStatus,redifFieldOrderURL,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldRestriction,redifFieldPrice,redifFieldNotification,redifFieldPublicationType,redifFieldJournal,redifFieldVolume,redifFieldYear,redifFieldIssue,redifFieldMonth,redifFieldPages,redifFieldNumber,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateChapter start=/^Template-Type:\_s*ReDIF-Chapter \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterAuthor,redifRegionClusterFile,redifRegionClusterProvider,redifRegionClusterPublisher,redifRegionClusterEditor,redifFieldHandleOfWork,redifFieldTitle,redifFieldContactEmail,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldBookTitle,redifFieldYear,redifFieldMonth,redifFieldPages,redifFieldChapter,redifFieldVolume,redifFieldEdition,redifFieldSeries,redifFieldISBN,redifFieldPublicationStatus,redifFieldNote,redifFieldInBook,redifFieldOrderURL,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateBook start=/^Template-Type:\_s*ReDIF-Book \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterAuthor,redifRegionClusterFile,redifRegionClusterProvider,redifRegionClusterPublisher,redifRegionClusterEditor,redifFieldTitle,redifFieldHandleOfWork,redifFieldContactEmail,redifFieldYear,redifFieldMonth,redifFieldVolume,redifFieldEdition,redifFieldSeries,redifFieldISBN,redifFieldPublicationStatus,redifFieldNote,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldHasChapter,redifFieldPrice,redifFieldOrderURL,redifFieldNumber,redifFieldCreationDate,redifFieldPublicationDate,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateSoftware start=/^Template-Type:\_s*ReDIF-Software \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterAuthor,redifRegionClusterFile,redifFieldHandleOfWork,redifFieldTitle,redifFieldProgrammingLanguage,redifFieldAbstract,redifFieldNumber,redifFieldVersion,redifFieldClassificationJEL,redifFieldKeywords,redifFieldSize,redifFieldSeries,redifFieldCreationDate,redifFieldRevisionDate,redifFieldNote,redifFieldRequires,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateArchive start=/^Template-Type:\_s*ReDIF-Archive \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifFieldHandleOfArchive,redifFieldURL,redifFieldMaintainerEmail,redifFieldName,redifFieldMaintainerName,redifFieldMaintainerPhone,redifFieldMaintainerFax,redifFieldClassificationJEL,redifFieldHomepage,redifFieldDescription,redifFieldNotification,redifFieldRestriction,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateSeries start=/^Template-Type:\_s*ReDIF-Series \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterProvider,redifRegionClusterPublisher,redifRegionClusterEditor,redifFieldName,redifFieldHandleOfSeries,redifFieldMaintainerEmail,redifFieldType,redifFieldOrderEmail,redifFieldOrderHomepage,redifFieldOrderPostal,redifFieldPrice,redifFieldRestriction,redifFieldMaintainerPhone,redifFieldMaintainerFax,redifFieldMaintainerName,redifFieldDescription,redifFieldClassificationJEL,redifFieldKeywords,redifFieldNotification,redifFieldISSN,redifFieldFollowup,redifFieldPredecessor,redifFieldTemplateType
|
||||
syntax region redifRegionTemplateInstitution start=/^Template-Type:\_s*ReDIF-Institution \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterPrimary,redifRegionClusterSecondary,redifRegionClusterTertiary,redifRegionClusterQuaternary,redifFieldHandleOfInstitution,redifFieldPrimaryDefunct,redifFieldSecondaryDefunct,redifFieldTertiaryDefunct,redifFieldTemplateType
|
||||
syntax region redifRegionTemplatePerson start=/^Template-Type:\_s*ReDIF-Person \d\+\.\d\+/ end=/^Template-Type:\_s*ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\) \d\+\.\d\+/me=s-1 contains=redifUnknownField,redifRegionClusterWorkplace,redifFieldHandleOfPerson,redifFieldNameFull,redifFieldNameFirst,redifFieldNameLast,redifFieldNamePrefix,redifFieldNameMiddle,redifFieldNameSuffix,redifFieldNameASCII,redifFieldEmail,redifFieldHomepage,redifFieldFax,redifFieldPostal,redifFieldPhone,redifFieldWorkplaceOrganization,redifFieldAuthorPaper,redifFieldAuthorArticle,redifFieldAuthorSoftware,redifFieldAuthorBook,redifFieldAuthorChapter,redifFieldEditorBook,redifFieldEditorSeries,redifFieldClassificationJEL,redifFieldShortId,redifFieldLastLoginDate,redifFieldRegisteredDate,redifFieldTemplateType
|
||||
syntax region redifRegionTemplatePaper start=/^Template-Type:\_s*ReDIF-Paper \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsPaper,redifWrongLine,redifRegionClusterAuthor,redifRegionClusterFile fold
|
||||
syntax region redifRegionTemplateArticle start=/^Template-Type:\_s*ReDIF-Article \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsArticle,redifWrongLine,redifRegionClusterAuthor,redifRegionClusterFile fold
|
||||
syntax region redifRegionTemplateChapter start=/^Template-Type:\_s*ReDIF-Chapter \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsChapter,redifWrongLine,redifRegionClusterAuthor,redifRegionClusterFile,redifRegionClusterProvider,redifRegionClusterPublisher,redifRegionClusterEditor fold
|
||||
syntax region redifRegionTemplateBook start=/^Template-Type:\_s*ReDIF-Book \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsBook,redifWrongLine,redifRegionClusterAuthor,redifRegionClusterFile,redifRegionClusterProvider,redifRegionClusterPublisher,redifRegionClusterEditor fold
|
||||
syntax region redifRegionTemplateSoftware start=/^Template-Type:\_s*ReDIF-Software \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsSoftware,redifWrongLine,redifRegionClusterAuthor,redifRegionClusterFile fold
|
||||
syntax region redifRegionTemplateArchive start=/^Template-Type:\_s*ReDIF-Archive \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsArchive,redifWrongLine fold
|
||||
syntax region redifRegionTemplateSeries start=/^Template-Type:\_s*ReDIF-Series \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsSeries,redifWrongLine,redifRegionClusterProvider,redifRegionClusterPublisher,redifRegionClusterEditor fold
|
||||
syntax region redifRegionTemplateInstitution start=/^Template-Type:\_s*ReDIF-Institution \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsInstitution,redifWrongLine,redifRegionClusterPrimary,redifRegionClusterSecondary,redifRegionClusterTertiary,redifRegionClusterQuaternary fold
|
||||
syntax region redifRegionTemplatePerson start=/^Template-Type:\_s*ReDIF-Person \d\+\.\d\+/ end=/^Template-Type:/me=s-1 contains=redifContainerFieldsPerson,redifWrongLine,redifRegionClusterWorkplace fold
|
||||
|
||||
" For each template, non-whitespaces ending with a colon must be
|
||||
" correct fields. By default, they are wrong fields.
|
||||
syntax match redifUnknownField /^\S\{-1,}:/ contained display
|
||||
" All fields are foldable (These come before clusters, so they have lower
|
||||
" priority). So they are contained in a foldable syntax region.
|
||||
syntax region redifContainerFieldsPaper start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldTitle,redifFieldHandleOfWork,redifFieldLanguage,redifFieldContactEmail,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldNumber,redifFieldCreationDate,redifFieldRevisionDate,redifFieldPublicationStatus,redifFieldNote,redifFieldLength,redifFieldSeries,redifFieldAvailability,redifFieldOrderURL,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldRestriction,redifFieldPrice,redifFieldNotification,redifFieldPublicationType,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsArticle start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldTitle,redifFieldHandleOfWork,redifFieldLanguage,redifFieldContactEmail,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldNumber,redifFieldCreationDate,redifFieldPublicationStatus,redifFieldOrderURL,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldRestriction,redifFieldPrice,redifFieldNotification,redifFieldPublicationType,redifFieldJournal,redifFieldVolume,redifFieldYear,redifFieldIssue,redifFieldMonth,redifFieldPages,redifFieldNumber,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsChapter start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldHandleOfWork,redifFieldTitle,redifFieldContactEmail,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldBookTitle,redifFieldYear,redifFieldMonth,redifFieldPages,redifFieldChapter,redifFieldVolume,redifFieldEdition,redifFieldSeries,redifFieldISBN,redifFieldPublicationStatus,redifFieldNote,redifFieldInBook,redifFieldOrderURL,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsBook start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldTitle,redifFieldHandleOfWork,redifFieldContactEmail,redifFieldYear,redifFieldMonth,redifFieldVolume,redifFieldEdition,redifFieldSeries,redifFieldISBN,redifFieldPublicationStatus,redifFieldNote,redifFieldAbstract,redifFieldClassificationJEL,redifFieldKeywords,redifFieldHasChapter,redifFieldPrice,redifFieldOrderURL,redifFieldNumber,redifFieldCreationDate,redifFieldPublicationDate,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsSoftware start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldHandleOfWork,redifFieldTitle,redifFieldProgrammingLanguage,redifFieldAbstract,redifFieldNumber,redifFieldVersion,redifFieldClassificationJEL,redifFieldKeywords,redifFieldSize,redifFieldSeries,redifFieldCreationDate,redifFieldRevisionDate,redifFieldNote,redifFieldRequires,redifFieldArticleHandle,redifFieldBookHandle,redifFieldChapterHandle,redifFieldPaperHandle,redifFieldSoftwareHandle,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsArchive start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldHandleOfArchive,redifFieldURL,redifFieldMaintainerEmail,redifFieldName,redifFieldMaintainerName,redifFieldMaintainerPhone,redifFieldMaintainerFax,redifFieldClassificationJEL,redifFieldHomepage,redifFieldDescription,redifFieldNotification,redifFieldRestriction,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsSeries start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldName,redifFieldHandleOfSeries,redifFieldMaintainerEmail,redifFieldType,redifFieldOrderEmail,redifFieldOrderHomepage,redifFieldOrderPostal,redifFieldPrice,redifFieldRestriction,redifFieldMaintainerPhone,redifFieldMaintainerFax,redifFieldMaintainerName,redifFieldDescription,redifFieldClassificationJEL,redifFieldKeywords,redifFieldNotification,redifFieldISSN,redifFieldFollowup,redifFieldPredecessor,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsInstitution start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldHandleOfInstitution,redifFieldPrimaryDefunct,redifFieldSecondaryDefunct,redifFieldTertiaryDefunct,redifFieldTemplateType,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsPerson start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldHandleOfPerson,redifFieldNameFull,redifFieldNameFirst,redifFieldNameLast,redifFieldNamePrefix,redifFieldNameMiddle,redifFieldNameSuffix,redifFieldNameASCII,redifFieldEmail,redifFieldHomepage,redifFieldFax,redifFieldPostal,redifFieldPhone,redifFieldWorkplaceOrganization,redifFieldAuthorPaper,redifFieldAuthorArticle,redifFieldAuthorSoftware,redifFieldAuthorBook,redifFieldAuthorChapter,redifFieldEditorBook,redifFieldEditorSeries,redifFieldClassificationJEL,redifFieldShortId,redifFieldLastLoginDate,redifFieldRegisteredDate,redifWrongLine contained transparent fold
|
||||
|
||||
highlight def link redifUnknownField redifError
|
||||
" Defines the 10 possible clusters and what they can contain
|
||||
" A field not in the cluster ends the cluster.
|
||||
syntax region redifRegionClusterWorkplace start=/^Workplace-Name:/ skip=/^Workplace-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsWorkplace fold
|
||||
syntax region redifRegionClusterPrimary start=/^Primary-Name:/ skip=/^Primary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsPrimary fold
|
||||
syntax region redifRegionClusterSecondary start=/^Secondary-Name:/ skip=/^Secondary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsSecondary fold
|
||||
syntax region redifRegionClusterTertiary start=/^Tertiary-Name:/ skip=/^Tertiary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsTertiary fold
|
||||
syntax region redifRegionClusterQuaternary start=/^Quaternary-Name:/ skip=/^Quaternary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsQuaternary fold
|
||||
syntax region redifRegionClusterProvider start=/^Provider-Name:/ skip=/^Provider-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsProvider fold
|
||||
syntax region redifRegionClusterPublisher start=/^Publisher-Name:/ skip=/^Publisher-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsPublisher fold
|
||||
syntax region redifRegionClusterAuthor start=/^Author-Name:/ skip=/^Author-\%(Name\%(-First\|-Last\)\|Homepage\|Email\|Fax\|Postal\|Phone\|Person\|Workplace-Name\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifRegionClusterAuthorWorkplace,redifContainerFieldsAuthor fold
|
||||
syntax region redifRegionClusterEditor start=/^Editor-Name:/ skip=/^Editor-\%(Name\%(-First\|-Last\)\|Homepage\|Email\|Fax\|Postal\|Phone\|Person\|Workplace-Name\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifRegionClusterEditorWorkplace,redifContainerFieldsEditor fold
|
||||
syntax region redifRegionClusterFile start=/^File-URL:/ skip=/^File-\%(Format\|Function\|Size\|Restriction\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsFile fold
|
||||
|
||||
" Defines the 12 possible clusters and what they can contain
|
||||
syntax region redifRegionClusterAuthorWorkplace start=/^Author-Workplace-Name:/ skip=/^Author-Workplace-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldAuthorWorkplaceName,redifFieldAuthorWorkplaceHomepage,redifFieldAuthorWorkplaceNameEnglish,redifFieldAuthorWorkplacePostal,redifFieldAuthorWorkplaceLocation,redifFieldAuthorWorkplaceEmail,redifFieldAuthorWorkplacePhone,redifFieldAuthorWorkplaceFax,redifFieldAuthorWorkplaceInstitution
|
||||
syntax region redifRegionClusterEditorWorkplace start=/^Editor-Workplace-Name:/ skip=/^Editor-Workplace-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldEditorWorkplaceName,redifFieldEditorWorkplaceHomepage,redifFieldEditorWorkplaceNameEnglish,redifFieldEditorWorkplacePostal,redifFieldEditorWorkplaceLocation,redifFieldEditorWorkplaceEmail,redifFieldEditorWorkplacePhone,redifFieldEditorWorkplaceFax,redifFieldEditorWorkplaceInstitution
|
||||
syntax region redifRegionClusterWorkplace start=/^Workplace-Name:/ skip=/^Workplace-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldWorkplaceName,redifFieldWorkplaceHomepage,redifFieldWorkplaceNameEnglish,redifFieldWorkplacePostal,redifFieldWorkplaceLocation,redifFieldWorkplaceEmail,redifFieldWorkplacePhone,redifFieldWorkplaceFax,redifFieldWorkplaceInstitution
|
||||
syntax region redifRegionClusterPrimary start=/^Primary-Name:/ skip=/^Primary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldPrimaryName,redifFieldPrimaryHomepage,redifFieldPrimaryNameEnglish,redifFieldPrimaryPostal,redifFieldPrimaryLocation,redifFieldPrimaryEmail,redifFieldPrimaryPhone,redifFieldPrimaryFax,redifFieldPrimaryInstitution
|
||||
syntax region redifRegionClusterSecondary start=/^Secondary-Name:/ skip=/^Secondary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldSecondaryName,redifFieldSecondaryHomepage,redifFieldSecondaryNameEnglish,redifFieldSecondaryPostal,redifFieldSecondaryLocation,redifFieldSecondaryEmail,redifFieldSecondaryPhone,redifFieldSecondaryFax,redifFieldSecondaryInstitution
|
||||
syntax region redifRegionClusterTertiary start=/^Tertiary-Name:/ skip=/^Tertiary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldTertiaryName,redifFieldTertiaryHomepage,redifFieldTertiaryNameEnglish,redifFieldTertiaryPostal,redifFieldTertiaryLocation,redifFieldTertiaryEmail,redifFieldTertiaryPhone,redifFieldTertiaryFax,redifFieldTertiaryInstitution
|
||||
syntax region redifRegionClusterQuaternary start=/^Quaternary-Name:/ skip=/^Quaternary-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldQuaternaryName,redifFieldQuaternaryHomepage,redifFieldQuaternaryNameEnglish,redifFieldQuaternaryPostal,redifFieldQuaternaryLocation,redifFieldQuaternaryEmail,redifFieldQuaternaryPhone,redifFieldQuaternaryFax,redifFieldQuaternaryInstitution
|
||||
syntax region redifRegionClusterProvider start=/^Provider-Name:/ skip=/^Provider-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldProviderName,redifFieldProviderHomepage,redifFieldProviderNameEnglish,redifFieldProviderPostal,redifFieldProviderLocation,redifFieldProviderEmail,redifFieldProviderPhone,redifFieldProviderFax,redifFieldProviderInstitution
|
||||
syntax region redifRegionClusterPublisher start=/^Publisher-Name:/ skip=/^Publisher-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldPublisherName,redifFieldPublisherHomepage,redifFieldPublisherNameEnglish,redifFieldPublisherPostal,redifFieldPublisherLocation,redifFieldPublisherEmail,redifFieldPublisherPhone,redifFieldPublisherFax,redifFieldPublisherInstitution
|
||||
syntax region redifRegionClusterAuthor start=/^Author-Name:/ skip=/^Author-\%(Name\%(-First\|-Last\)\|Homepage\|Email\|Fax\|Postal\|Phone\|Person\|Workplace-Name\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifRegionClusterAuthorWorkplace,redifFieldAuthorName,redifFieldAuthorNameFirst,redifFieldAuthorNameLast,redifFieldAuthorHomepage,redifFieldAuthorEmail,redifFieldAuthorFax,redifFieldAuthorPostal,redifFieldAuthorPhone,redifFieldAuthorPerson
|
||||
syntax region redifRegionClusterEditor start=/^Editor-Name:/ skip=/^Editor-\%(Name\%(-First\|-Last\)\|Homepage\|Email\|Fax\|Postal\|Phone\|Person\|Workplace-Name\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifRegionClusterEditorWorkplace,redifFieldEditorName,redifFieldEditorNameFirst,redifFieldEditorNameLast,redifFieldEditorHomepage,redifFieldEditorEmail,redifFieldEditorFax,redifFieldEditorPostal,redifFieldEditorPhone,redifFieldEditorPerson
|
||||
syntax region redifRegionClusterFile start=/^File-URL:/ skip=/^File-\%(Format\|Function\|Size\|Restriction\):/ end=/^\c\S\{-1,}:/me=s-1 contained contains=redifFieldFileURL,redifFieldFileFormat,redifFieldFileFunction,redifFieldFileSize,redifFieldFileRestriction
|
||||
" The foldable containers of the clusters.
|
||||
syntax region redifContainerFieldsWorkplace start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldWorkplaceName,redifFieldWorkplaceHomepage,redifFieldWorkplaceNameEnglish,redifFieldWorkplacePostal,redifFieldWorkplaceLocation,redifFieldWorkplaceEmail,redifFieldWorkplacePhone,redifFieldWorkplaceFax,redifFieldWorkplaceInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsPrimary start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldPrimaryName,redifFieldPrimaryHomepage,redifFieldPrimaryNameEnglish,redifFieldPrimaryPostal,redifFieldPrimaryLocation,redifFieldPrimaryEmail,redifFieldPrimaryPhone,redifFieldPrimaryFax,redifFieldPrimaryInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsSecondary start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldSecondaryName,redifFieldSecondaryHomepage,redifFieldSecondaryNameEnglish,redifFieldSecondaryPostal,redifFieldSecondaryLocation,redifFieldSecondaryEmail,redifFieldSecondaryPhone,redifFieldSecondaryFax,redifFieldSecondaryInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsTertiary start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldTertiaryName,redifFieldTertiaryHomepage,redifFieldTertiaryNameEnglish,redifFieldTertiaryPostal,redifFieldTertiaryLocation,redifFieldTertiaryEmail,redifFieldTertiaryPhone,redifFieldTertiaryFax,redifFieldTertiaryInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsQuaternary start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldQuaternaryName,redifFieldQuaternaryHomepage,redifFieldQuaternaryNameEnglish,redifFieldQuaternaryPostal,redifFieldQuaternaryLocation,redifFieldQuaternaryEmail,redifFieldQuaternaryPhone,redifFieldQuaternaryFax,redifFieldQuaternaryInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsProvider start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldProviderName,redifFieldProviderHomepage,redifFieldProviderNameEnglish,redifFieldProviderPostal,redifFieldProviderLocation,redifFieldProviderEmail,redifFieldProviderPhone,redifFieldProviderFax,redifFieldProviderInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsPublisher start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldPublisherName,redifFieldPublisherHomepage,redifFieldPublisherNameEnglish,redifFieldPublisherPostal,redifFieldPublisherLocation,redifFieldPublisherEmail,redifFieldPublisherPhone,redifFieldPublisherFax,redifFieldPublisherInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsAuthor start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldAuthorName,redifFieldAuthorNameFirst,redifFieldAuthorNameLast,redifFieldAuthorHomepage,redifFieldAuthorEmail,redifFieldAuthorFax,redifFieldAuthorPostal,redifFieldAuthorPhone,redifFieldAuthorPerson,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsEditor start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldEditorName,redifFieldEditorNameFirst,redifFieldEditorNameLast,redifFieldEditorHomepage,redifFieldEditorEmail,redifFieldEditorFax,redifFieldEditorPostal,redifFieldEditorPhone,redifFieldEditorPerson,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsFile start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldFileURL,redifFieldFileFormat,redifFieldFileFunction,redifFieldFileSize,redifFieldFileRestriction,redifWrongLine contained transparent fold
|
||||
|
||||
" A field not in the cluster ends the cluster, so no need to define wrong
|
||||
" fields, because they will be handled by the containing UnknownField region
|
||||
" immediately when exiting the cluster.
|
||||
" The two clusters in cluster (must be presented after to have priority over
|
||||
" fields containers)
|
||||
syntax region redifRegionClusterAuthorWorkplace start=/^Author-Workplace-Name:/ skip=/^Author-Workplace-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsAuthorWorkplace fold
|
||||
syntax region redifRegionClusterEditorWorkplace start=/^Editor-Workplace-Name:/ skip=/^Editor-Workplace-\%(Name-English\|Homepage\|Postal\|Location\|Email\|Phone\|Fax\|Institution\):/ end=/^\S\{-}:/me=s-1 contained contains=redifWrongLine,redifContainerFieldsEditorWorkplace fold
|
||||
|
||||
" Their foldable fields containers
|
||||
syntax region redifContainerFieldsAuthorWorkplace start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldAuthorWorkplaceName,redifFieldAuthorWorkplaceHomepage,redifFieldAuthorWorkplaceNameEnglish,redifFieldAuthorWorkplacePostal,redifFieldAuthorWorkplaceLocation,redifFieldAuthorWorkplaceEmail,redifFieldAuthorWorkplacePhone,redifFieldAuthorWorkplaceFax,redifFieldAuthorWorkplaceInstitution,redifWrongLine contained transparent fold
|
||||
syntax region redifContainerFieldsEditorWorkplace start=/^\S\{-}:/ end=/^\S\{-}:/me=s-1 contains=redifFieldEditorWorkplaceName,redifFieldEditorWorkplaceHomepage,redifFieldEditorWorkplaceNameEnglish,redifFieldEditorWorkplacePostal,redifFieldEditorWorkplaceLocation,redifFieldEditorWorkplaceEmail,redifFieldEditorWorkplacePhone,redifFieldEditorWorkplaceFax,redifFieldEditorWorkplaceInstitution,redifWrongLine contained transparent fold
|
||||
|
||||
" All the possible fields
|
||||
" Note: The "Handle" field is handled a little bit differently, because it
|
||||
" does not have the same meaning depending on the Template-Type.
|
||||
" /redifFieldHandleOf....
|
||||
" Note: The "Handle" field is handled a little bit differently, because it
|
||||
" does not have the same meaning depending on the Template-Type. See:
|
||||
" /redifFieldHandleOf....
|
||||
syntax match redifFieldAbstract /^Abstract:/ skipwhite skipempty nextgroup=redifArgumentAbstract contained
|
||||
syntax match redifFieldArticleHandle /^Article-Handle:/ skipwhite skipempty nextgroup=redifArgumentArticleHandle contained
|
||||
syntax match redifFieldAuthorArticle /^Author-Article:/ skipwhite skipempty nextgroup=redifArgumentAuthorArticle contained
|
||||
@@ -211,15 +227,6 @@ syntax match redifFieldProviderPostal /^Provider-Postal:/ skipwhite skipempty ne
|
||||
syntax match redifFieldPublicationDate /^Publication-Date:/ skipwhite skipempty nextgroup=redifArgumentPublicationDate contained
|
||||
syntax match redifFieldPublicationStatus /^Publication-Status:/ skipwhite skipempty nextgroup=redifArgumentPublicationStatus contained
|
||||
syntax match redifFieldPublicationType /^Publication-Type:/ skipwhite skipempty nextgroup=redifArgumentPublicationType contained
|
||||
syntax match redifFieldPublisherEmail /^Publisher-Email:/ skipwhite skipempty nextgroup=redifArgumentPublisherEmail contained
|
||||
syntax match redifFieldPublisherFax /^Publisher-Fax:/ skipwhite skipempty nextgroup=redifArgumentPublisherFax contained
|
||||
syntax match redifFieldPublisherHomepage /^Publisher-Homepage:/ skipwhite skipempty nextgroup=redifArgumentPublisherHomepage contained
|
||||
syntax match redifFieldPublisherInstitution /^Publisher-Institution:/ skipwhite skipempty nextgroup=redifArgumentPublisherInstitution contained
|
||||
syntax match redifFieldPublisherLocation /^Publisher-Location:/ skipwhite skipempty nextgroup=redifArgumentPublisherLocation contained
|
||||
syntax match redifFieldPublisherName /^Publisher-Name:/ skipwhite skipempty nextgroup=redifArgumentPublisherName contained
|
||||
syntax match redifFieldPublisherNameEnglish /^Publisher-Name-English:/ skipwhite skipempty nextgroup=redifArgumentPublisherNameEnglish contained
|
||||
syntax match redifFieldPublisherPhone /^Publisher-Phone:/ skipwhite skipempty nextgroup=redifArgumentPublisherPhone contained
|
||||
syntax match redifFieldPublisherPostal /^Publisher-Postal:/ skipwhite skipempty nextgroup=redifArgumentPublisherPostal contained
|
||||
syntax match redifFieldQuaternaryEmail /^Quaternary-Email:/ skipwhite skipempty nextgroup=redifArgumentQuaternaryEmail contained
|
||||
syntax match redifFieldQuaternaryFax /^Quaternary-Fax:/ skipwhite skipempty nextgroup=redifArgumentQuaternaryFax contained
|
||||
syntax match redifFieldQuaternaryHomepage /^Quaternary-Homepage:/ skipwhite skipempty nextgroup=redifArgumentQuaternaryHomepage contained
|
||||
@@ -404,15 +411,6 @@ highlight def link redifFieldProviderPostal redifField
|
||||
highlight def link redifFieldPublicationDate redifField
|
||||
highlight def link redifFieldPublicationStatus redifField
|
||||
highlight def link redifFieldPublicationType redifField
|
||||
highlight def link redifFieldPublisherEmail redifField
|
||||
highlight def link redifFieldPublisherFax redifField
|
||||
highlight def link redifFieldPublisherHomepage redifField
|
||||
highlight def link redifFieldPublisherInstitution redifField
|
||||
highlight def link redifFieldPublisherLocation redifField
|
||||
highlight def link redifFieldPublisherName redifField
|
||||
highlight def link redifFieldPublisherNameEnglish redifField
|
||||
highlight def link redifFieldPublisherPhone redifField
|
||||
highlight def link redifFieldPublisherPostal redifField
|
||||
highlight def link redifFieldQuaternaryEmail redifField
|
||||
highlight def link redifFieldQuaternaryFax redifField
|
||||
highlight def link redifFieldQuaternaryHomepage redifField
|
||||
@@ -469,129 +467,156 @@ highlight def link redifFieldWorkplacePhone redifField
|
||||
highlight def link redifFieldWorkplacePostal redifField
|
||||
highlight def link redifFieldYear redifField
|
||||
|
||||
" Deprecated
|
||||
" same as Provider-*
|
||||
" nextgroup=redifArgumentProvider*
|
||||
syntax match redifFieldPublisherEmail /^Publisher-Email:/ skipwhite skipempty nextgroup=redifArgumentProviderEmail contained
|
||||
syntax match redifFieldPublisherFax /^Publisher-Fax:/ skipwhite skipempty nextgroup=redifArgumentProviderFax contained
|
||||
syntax match redifFieldPublisherHomepage /^Publisher-Homepage:/ skipwhite skipempty nextgroup=redifArgumentProviderHomepage contained
|
||||
syntax match redifFieldPublisherInstitution /^Publisher-Institution:/ skipwhite skipempty nextgroup=redifArgumentProviderInstitution contained
|
||||
syntax match redifFieldPublisherLocation /^Publisher-Location:/ skipwhite skipempty nextgroup=redifArgumentProviderLocation contained
|
||||
syntax match redifFieldPublisherName /^Publisher-Name:/ skipwhite skipempty nextgroup=redifArgumentProviderName contained
|
||||
syntax match redifFieldPublisherNameEnglish /^Publisher-Name-English:/ skipwhite skipempty nextgroup=redifArgumentProviderNameEnglish contained
|
||||
syntax match redifFieldPublisherPhone /^Publisher-Phone:/ skipwhite skipempty nextgroup=redifArgumentProviderPhone contained
|
||||
syntax match redifFieldPublisherPostal /^Publisher-Postal:/ skipwhite skipempty nextgroup=redifArgumentProviderPostal contained
|
||||
|
||||
highlight def link redifFieldPublisherEmail redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherFax redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherHomepage redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherInstitution redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherLocation redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherName redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherNameEnglish redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherPhone redifFieldDeprecated
|
||||
highlight def link redifFieldPublisherPostal redifFieldDeprecated
|
||||
|
||||
" Standard arguments
|
||||
" Contains all the remaining line if it is not a new field
|
||||
" /\%(^\S\{-}:\)\@!\S.*/
|
||||
" Note: Those arguments are not highlighted so far. They are here for
|
||||
" future extensions.
|
||||
" Note: Those matches do not extend further the end of the line. They are
|
||||
" unfit for arguments that may span several lines like Title, Abstract,
|
||||
" Postal. They are well-fit for arguments that must not span more than one
|
||||
" line by definition, such as URLs, Email addresses, etc.
|
||||
" By default, they contain all the argument until another field is started:
|
||||
" start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1
|
||||
" For arguments that must not span more than one line, use a match:
|
||||
" /\%(^\S\{-}:\)\@!\S.*/
|
||||
" AND ADD "display"
|
||||
" This is faster.
|
||||
"
|
||||
" Those arguments are not highlighted so far. They are here for future
|
||||
" extensions.
|
||||
" TODO Find more RegEx for these arguments
|
||||
" TODO Fax, Phone
|
||||
" TODO URL, Homepage
|
||||
" TODO Keywords
|
||||
" TODO Classification-JEL
|
||||
" TODO Short-Id, Author-Person, Editor-Person
|
||||
"syntax match redifArgumentAuthorFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorNameFirst /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorNameLast /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorPerson /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplaceFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplaceHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplaceLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplaceName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplaceNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplacePhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentAuthorWorkplacePostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorNameFirst /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorNameLast /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorPerson /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplaceFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplaceHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplaceLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplaceName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplaceNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplacePhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentEditorWorkplacePostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentFileFunction /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentFileURL /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentIssue /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentJournal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentMaintainerFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentMaintainerName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentMaintainerPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentNameFirst /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentNameFull /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentNameLast /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentNameMiddle /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentNamePrefix /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentNameSuffix /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentOrderHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentOrderPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentOrderURL /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrice /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPrimaryPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentProviderPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentPublisherPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentQuaternaryPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentRequires /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSecondaryPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSeries /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentSize /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentShortId /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryPhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentTertiaryPostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentURL /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentVersion /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplaceFax /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplaceHomepage /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplaceLocation /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplaceName /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplaceNameEnglish /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplaceOrganization /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplacePhone /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"syntax match redifArgumentWorkplacePostal /\%(^\S\{-}:\)\@!\S.*/ contained display
|
||||
"
|
||||
" Arguments that may span several lines:
|
||||
syntax region redifArgumentAuthorWorkplaceLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorWorkplacePostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplacePostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentFileFunction start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentIssue start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentJournal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentOrderPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrice start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentRequires start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSize start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentVersion start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplaceLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplacePhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplacePostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
|
||||
" Arguments that may not span several lines:
|
||||
" If you are sure that these arguments cannot span several lines, change
|
||||
" them to a match:
|
||||
" /\%(^\S\{-}:\)\@!\S.*/
|
||||
" AND ADD "display" after "contained"
|
||||
" You can use this command on each line that you want to change:
|
||||
" :s+\Vregion \(\w\+\) start=/\\%(^\\S\\{-}:\\)\\@!\\S/ end=/^\\S\\{-}:/me=s-1 contained+match \1 /\\%(^\\S\\{-}:\\)\\@!\\S.*/ contained display
|
||||
syntax region redifArgumentAuthorFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorNameFirst start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorNameLast start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorPerson start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorPostal start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorWorkplaceFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorWorkplaceHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorWorkplaceName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorWorkplaceNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentAuthorWorkplacePhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorNameFirst start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorNameLast start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorPerson start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplaceFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplaceHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplaceLocation start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplaceName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplaceNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentEditorWorkplacePhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentFileURL start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentMaintainerFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentMaintainerName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentMaintainerPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentNameFirst start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentNameFull start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentNameLast start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentNameMiddle start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentNamePrefix start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentNameSuffix start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentOrderHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentOrderURL start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentPrimaryPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentProviderPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentQuaternaryPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSecondaryPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentSeries start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentShortId start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentTertiaryPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentURL start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplaceFax start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplaceHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplaceName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplaceNameEnglish start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
syntax region redifArgumentWorkplaceOrganization start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained
|
||||
|
||||
" Special arguments
|
||||
" Those arguments require special values
|
||||
@@ -604,12 +629,14 @@ highlight def link redifFieldYear redifField
|
||||
"
|
||||
" Template-Type
|
||||
syntax match redifArgumentTemplateType /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectTemplateType contained display
|
||||
syntax match redifCorrectTemplateType /ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\)/ nextgroup=redifTemplateVersionNumber contained display
|
||||
syntax match redifTemplateVersionNumber / \d\+\.\d\+/ contained display
|
||||
syntax match redifCorrectTemplateType /ReDIF-\%(Paper\|Article\|Chapter\|Book\|Software\|Archive\|Series\|Institution\|Person\)/ nextgroup=redifTemplateVersionNumberContainer contained display
|
||||
syntax match redifTemplateVersionNumberContainer /.\+/ contains=redifTemplateVersionNumber contained display
|
||||
syntax match redifTemplateVersionNumber / \d\+\.\d\+/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentTemplateType redifError
|
||||
highlight def link redifCorrectTemplateType Constant
|
||||
highlight def link redifTemplateVersionNumber Number
|
||||
highlight def link redifTemplateVersionNumberContainer redifError
|
||||
|
||||
" Handles:
|
||||
"
|
||||
@@ -629,7 +656,7 @@ syntax match redifArgumentBookHandle /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrec
|
||||
syntax match redifArgumentChapterHandle /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfWork contained display
|
||||
syntax match redifArgumentPaperHandle /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfWork contained display
|
||||
syntax match redifArgumentSoftwareHandle /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfWork contained display
|
||||
syntax match redifCorrectHandleOfWork /RePEc:\a\a\a:\%(_\@!\w\)\{6}:\S\+/ contains=redifForbiddenCharactersInHandle,redifBestPracticeInHandle contained display
|
||||
syntax match redifCorrectHandleOfWork /RePEc:\a\a\a:\%(_\@!\w\)\{6}:\S\+/ contains=redifForbiddenCharactersInHandle,redifBestPracticeInHandle nextgroup=redifWrongLineEnding contained display
|
||||
" TODO Are those characters really forbidden???
|
||||
syntax match redifForbiddenCharactersInHandle /[\/*?"<>|]/ contained display
|
||||
syntax match redifBestPracticeInHandle /\<\%([vi]:[1-9]\d*\|y:[1-9]\d\{3}\|p:[1-9]\d*-[1-9]\d*\|i:\%(jan\|feb\|mar\|apr\|may\|jun\|jul\|aug\|sep\|oct\|nov\|dec\|spr\|sum\|aut\|win\|spe\|Q[1-4]\|\d\d-\d\d\)\|Q:[1-4]\)\>/ contained display
|
||||
@@ -656,7 +683,7 @@ highlight def link redifBestPracticeInHandle redifSpecial
|
||||
syntax match redifArgumentHandleOfSeries /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfSeries contained display
|
||||
syntax match redifArgumentFollowup /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfSeries contained display
|
||||
syntax match redifArgumentPredecessor /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfSeries contained display
|
||||
syntax match redifCorrectHandleOfSeries /RePEc:\a\a\a:\%(_\@!\w\)\{6}/ contained display
|
||||
syntax match redifCorrectHandleOfSeries /RePEc:\a\a\a:\%(_\@!\w\)\{6}/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentHandleOfSeries redifError
|
||||
highlight def link redifArgumentFollowup redifError
|
||||
@@ -664,13 +691,13 @@ highlight def link redifArgumentPredecessor redifError
|
||||
|
||||
" Handles of Archives:
|
||||
syntax match redifArgumentHandleOfArchive /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfArchive contained display
|
||||
syntax match redifCorrectHandleOfArchive /RePEc:\a\a\a/ contained display
|
||||
syntax match redifCorrectHandleOfArchive /RePEc:\a\a\a/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentHandleOfArchive redifError
|
||||
|
||||
" Handles of Person:
|
||||
syntax match redifArgumentHandleOfPerson /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectHandleOfPerson contained display
|
||||
syntax match redifCorrectHandleOfPerson /\%(\%(:\@!\S\)\{-}:\)\{2}[1-9]\d\{3}\%(-02\%(-[12]\d\|-0[1-9]\)\|-\%(0[469]\|11\)\%(-30\|-[12]\d\|-0[1-9]\)\|-\%(0[13578]\|1[02]\)\%(-3[01]\|-[12]\d\|-0[1-9]\)\):\S\+/ contained display
|
||||
syntax match redifCorrectHandleOfPerson /\%(\%(:\@!\S\)\{-}:\)\{2}[1-9]\d\{3}\%(-02\%(-[12]\d\|-0[1-9]\)\|-\%(0[469]\|11\)\%(-30\|-[12]\d\|-0[1-9]\)\|-\%(0[13578]\|1[02]\)\%(-3[01]\|-[12]\d\|-0[1-9]\)\):\S\+/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentHandleOfPerson redifError
|
||||
|
||||
@@ -691,7 +718,7 @@ syntax match redifArgumentTertiaryDefunct /\%(^\S\{-}:\)\@!\S.*/ contains=redifC
|
||||
" TODO Are digits authorized? Apparently not.
|
||||
" Country codes:
|
||||
" http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm
|
||||
syntax match redifCorrectHandleOfInstitution /RePEc:\a\a\a:\a\{5}\(ea\|af\|ax\|al\|dz\|as\|ad\|ao\|ai\|aq\|ag\|ar\|am\|aw\|au\|at\|az\|bs\|bh\|bd\|bb\|by\|be\|bz\|bj\|bm\|bt\|bo\|bq\|ba\|bw\|bv\|br\|io\|bn\|bg\|bf\|bi\|kh\|cm\|ca\|cv\|ky\|cf\|td\|cl\|cn\|cx\|cc\|co\|km\|cg\|cd\|ck\|cr\|ci\|hr\|cu\|cw\|cy\|cz\|dk\|dj\|dm\|do\|ec\|eg\|sv\|gq\|er\|ee\|et\|fk\|fo\|fj\|fi\|fr\|gf\|pf\|tf\|ga\|gm\|ge\|de\|gh\|gi\|gr\|gl\|gd\|gp\|gu\|gt\|gg\|gn\|gw\|gy\|ht\|hm\|va\|hn\|hk\|hu\|is\|in\|id\|ir\|iq\|ie\|im\|il\|it\|jm\|jp\|je\|jo\|kz\|ke\|ki\|kp\|kr\|kw\|kg\|la\|lv\|lb\|ls\|lr\|ly\|li\|lt\|lu\|mo\|mk\|mg\|mw\|my\|mv\|ml\|mt\|mh\|mq\|mr\|mu\|yt\|mx\|fm\|md\|mc\|mn\|me\|ms\|ma\|mz\|mm\|na\|nr\|np\|nl\|nc\|nz\|ni\|ne\|ng\|nu\|nf\|mp\|no\|om\|pk\|pw\|ps\|pa\|pg\|py\|pe\|ph\|pn\|pl\|pt\|pr\|qa\|re\|ro\|ru\|rw\|bl\|sh\|kn\|lc\|mf\|pm\|vc\|ws\|sm\|st\|sa\|sn\|rs\|sc\|sl\|sg\|sx\|sk\|si\|sb\|so\|za\|gs\|ss\|es\|lk\|sd\|sr\|sj\|sz\|se\|ch\|sy\|tw\|tj\|tz\|th\|tl\|tg\|tk\|to\|tt\|tn\|tr\|tm\|tc\|tv\|ug\|ua\|ae\|gb\|us\|um\|uy\|uz\|vu\|ve\|vn\|vg\|vi\|wf\|eh\|ye\|zm\|zw\)/ contained display
|
||||
syntax match redifCorrectHandleOfInstitution /RePEc:\a\a\a:\a\{5}\(ea\|af\|ax\|al\|dz\|as\|ad\|ao\|ai\|aq\|ag\|ar\|am\|aw\|au\|at\|az\|bs\|bh\|bd\|bb\|by\|be\|bz\|bj\|bm\|bt\|bo\|bq\|ba\|bw\|bv\|br\|io\|bn\|bg\|bf\|bi\|kh\|cm\|ca\|cv\|ky\|cf\|td\|cl\|cn\|cx\|cc\|co\|km\|cg\|cd\|ck\|cr\|ci\|hr\|cu\|cw\|cy\|cz\|dk\|dj\|dm\|do\|ec\|eg\|sv\|gq\|er\|ee\|et\|fk\|fo\|fj\|fi\|fr\|gf\|pf\|tf\|ga\|gm\|ge\|de\|gh\|gi\|gr\|gl\|gd\|gp\|gu\|gt\|gg\|gn\|gw\|gy\|ht\|hm\|va\|hn\|hk\|hu\|is\|in\|id\|ir\|iq\|ie\|im\|il\|it\|jm\|jp\|je\|jo\|kz\|ke\|ki\|kp\|kr\|kw\|kg\|la\|lv\|lb\|ls\|lr\|ly\|li\|lt\|lu\|mo\|mk\|mg\|mw\|my\|mv\|ml\|mt\|mh\|mq\|mr\|mu\|yt\|mx\|fm\|md\|mc\|mn\|me\|ms\|ma\|mz\|mm\|na\|nr\|np\|nl\|nc\|nz\|ni\|ne\|ng\|nu\|nf\|mp\|no\|om\|pk\|pw\|ps\|pa\|pg\|py\|pe\|ph\|pn\|pl\|pt\|pr\|qa\|re\|ro\|ru\|rw\|bl\|sh\|kn\|lc\|mf\|pm\|vc\|ws\|sm\|st\|sa\|sn\|rs\|sc\|sl\|sg\|sx\|sk\|si\|sb\|so\|za\|gs\|ss\|es\|lk\|sd\|sr\|sj\|sz\|se\|ch\|sy\|tw\|tj\|tz\|th\|tl\|tg\|tk\|to\|tt\|tn\|tr\|tm\|tc\|tv\|ug\|ua\|ae\|gb\|us\|um\|uy\|uz\|vu\|ve\|vn\|vg\|vi\|wf\|eh\|ye\|zm\|zw\)/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentHandleOfInstitution redifError
|
||||
highlight def link redifArgumentPrimaryDefunct redifError
|
||||
@@ -714,7 +741,7 @@ syntax match redifArgumentQuaternaryEmail /\%(^\S\{-}:\)\@!\S.*/ contains=redifC
|
||||
syntax match redifArgumentSecondaryEmail /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectEmail contained display
|
||||
syntax match redifArgumentTertiaryEmail /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectEmail contained display
|
||||
syntax match redifArgumentWorkplaceEmail /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectEmail contained display
|
||||
syntax match redifCorrectEmail /\%(@\@!\S\)\+@\%(@\@!\S\)\+/ contained display
|
||||
syntax match redifCorrectEmail /\%(@\@!\S\)\+@\%(@\@!\S\)\+/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentAuthorEmail redifError
|
||||
highlight def link redifArgumentAuthorWorkplaceEmail redifError
|
||||
@@ -735,7 +762,7 @@ highlight def link redifArgumentWorkplaceEmail redifError
|
||||
" Language
|
||||
" Source: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
syntax match redifArgumentLanguage /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectLanguage contained display
|
||||
syntax match redifCorrectLanguage /\<\(aa\|ab\|af\|ak\|als\|am\|an\|ang\|ar\|arc\|as\|ast\|av\|ay\|az\|ba\|bar\|bat-smg\|bcl\|be\|be-x-old\|bg\|bh\|bi\|bm\|bn\|bo\|bpy\|br\|bs\|bug\|bxr\|ca\|ce\|ceb\|ch\|cho\|chr\|chy\|co\|cr\|cs\|csb\|cu\|cv\|cy\|da\|de\|diq\|dsb\|dv\|dz\|ee\|el\|en\|eo\|es\|et\|eu\|ext\|fa\|ff\|fi\|fiu-vro\|fj\|fo\|fr\|frp\|fur\|fy\|ga\|gd\|gil\|gl\|gn\|got\|gu\|gv\|ha\|haw\|he\|hi\|ho\|hr\|ht\|hu\|hy\|hz\|ia\|id\|ie\|ig\|ii\|ik\|ilo\|io\|is\|it\|iu\|ja\|jbo\|jv\|ka\|kg\|ki\|kj\|kk\|kl\|km\|kn\|khw\|ko\|kr\|ks\|ksh\|ku\|kv\|kw\|ky\|la\|lad\|lan\|lb\|lg\|li\|lij\|lmo\|ln\|lo\|lt\|lv\|map-bms\|mg\|mh\|mi\|mk\|ml\|mn\|mo\|mr\|ms\|mt\|mus\|my\|na\|nah\|nap\|nd\|nds\|nds-nl\|ne\|new\|ng\|nl\|nn\|no\|nr\|nso\|nrm\|nv\|ny\|oc\|oj\|om\|or\|os\|pa\|pag\|pam\|pap\|pdc\|pi\|pih\|pl\|pms\|ps\|pt\|qu\|rm\|rmy\|rn\|ro\|roa-rup\|ru\|rw\|sa\|sc\|scn\|sco\|sd\|se\|sg\|sh\|si\|simple\|sk\|sl\|sm\|sn\|so\|sq\|sr\|ss\|st\|su\|sv\|sw\|ta\|te\|tet\|tg\|th\|ti\|tk\|tl\|tlh\|tn\|to\|tpi\|tr\|ts\|tt\|tum\|tw\|ty\|udm\|ug\|uk\|ur\|uz\|ve\|vi\|vec\|vls\|vo\|wa\|war\|wo\|xal\|xh\|yi\|yo\|za\|zh\|zh-min-nan\|zh-yue\|zu\)\>/ contained display
|
||||
syntax match redifCorrectLanguage /\<\(aa\|ab\|af\|ak\|als\|am\|an\|ang\|ar\|arc\|as\|ast\|av\|ay\|az\|ba\|bar\|bat-smg\|bcl\|be\|be-x-old\|bg\|bh\|bi\|bm\|bn\|bo\|bpy\|br\|bs\|bug\|bxr\|ca\|ce\|ceb\|ch\|cho\|chr\|chy\|co\|cr\|cs\|csb\|cu\|cv\|cy\|da\|de\|diq\|dsb\|dv\|dz\|ee\|el\|en\|eo\|es\|et\|eu\|ext\|fa\|ff\|fi\|fiu-vro\|fj\|fo\|fr\|frp\|fur\|fy\|ga\|gd\|gil\|gl\|gn\|got\|gu\|gv\|ha\|haw\|he\|hi\|ho\|hr\|ht\|hu\|hy\|hz\|ia\|id\|ie\|ig\|ii\|ik\|ilo\|io\|is\|it\|iu\|ja\|jbo\|jv\|ka\|kg\|ki\|kj\|kk\|kl\|km\|kn\|khw\|ko\|kr\|ks\|ksh\|ku\|kv\|kw\|ky\|la\|lad\|lan\|lb\|lg\|li\|lij\|lmo\|ln\|lo\|lt\|lv\|map-bms\|mg\|mh\|mi\|mk\|ml\|mn\|mo\|mr\|ms\|mt\|mus\|my\|na\|nah\|nap\|nd\|nds\|nds-nl\|ne\|new\|ng\|nl\|nn\|no\|nr\|nso\|nrm\|nv\|ny\|oc\|oj\|om\|or\|os\|pa\|pag\|pam\|pap\|pdc\|pi\|pih\|pl\|pms\|ps\|pt\|qu\|rm\|rmy\|rn\|ro\|roa-rup\|ru\|rw\|sa\|sc\|scn\|sco\|sd\|se\|sg\|sh\|si\|simple\|sk\|sl\|sm\|sn\|so\|sq\|sr\|ss\|st\|su\|sv\|sw\|ta\|te\|tet\|tg\|th\|ti\|tk\|tl\|tlh\|tn\|to\|tpi\|tr\|ts\|tt\|tum\|tw\|ty\|udm\|ug\|uk\|ur\|uz\|ve\|vi\|vec\|vls\|vo\|wa\|war\|wo\|xal\|xh\|yi\|yo\|za\|zh\|zh-min-nan\|zh-yue\|zu\)\>/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentLanguage redifError
|
||||
highlight def link redifCorrectLanguage redifSpecial
|
||||
@@ -743,22 +770,22 @@ highlight def link redifCorrectLanguage redifSpecial
|
||||
" Length
|
||||
" Based on the example in the documentation. But apparently any field is
|
||||
" possible
|
||||
syntax match redifArgumentLength /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodLength contained display
|
||||
syntax region redifArgumentLength start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=redifGoodLength contained
|
||||
syntax match redifGoodLength /1 page\|[1-9]\d*\%( pages\)\=/ contained display
|
||||
|
||||
highlight def link redifGoodLength redifSpecial
|
||||
|
||||
" Publication-Type
|
||||
syntax match redifArgumentPublicationType /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectPublicationType contained display
|
||||
syntax match redifCorrectPublicationType /\<\(journal article\|book\|book chapter\|working paper\|conference paper\|report\|other\)\>/ contained display
|
||||
syntax match redifCorrectPublicationType /\<\(journal article\|book\|book chapter\|working paper\|conference paper\|report\|other\)\>/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentPublicationType redifError
|
||||
highlight def link redifCorrectPublicationType redifSpecial
|
||||
|
||||
" Publication-Status
|
||||
syntax match redifArgumentPublicationStatus /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectPublicationStatus contained display
|
||||
syntax match redifCorrectPublicationStatus /\<\%(published\|forthcoming\)\>.*/ contains=redifSpecialPublicationStatus contained display
|
||||
syntax match redifSpecialPublicationStatus /published\|forthcoming/ contained display
|
||||
syntax region redifArgumentPublicationStatus start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=redifSpecialPublicationStatus contained
|
||||
syntax match redifSpecialPublicationStatus /published\|forthcoming/ nextgroup=redifCorrectPublicationStatus contained display
|
||||
syntax region redifCorrectPublicationStatus start=/./ end=/^\S\{-}:/me=s-1 contained
|
||||
|
||||
highlight def link redifArgumentPublicationStatus redifError
|
||||
highlight def link redifSpecialPublicationStatus redifSpecial
|
||||
@@ -766,7 +793,7 @@ highlight def link redifSpecialPublicationStatus redifSpecial
|
||||
" Month
|
||||
" TODO Are numbers also allowed?
|
||||
syntax match redifArgumentMonth /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodMonth contained display
|
||||
syntax match redifGoodMonth /\<\(Jan\%(uary\)\=\|Feb\%(ruary\)\=\|Mar\%(ch\)\=\|Apr\%(il\)\=\|May\|June\=\|July\=\|Aug\%(ust\)\=\|Sep\%(tember\)\=\|Oct\%(ober\)\=\|Nov\%(ember\)\=\|Dec\%(ember\)\=\)\>/ contained display
|
||||
syntax match redifGoodMonth /\<\(Jan\%(uary\)\=\|Feb\%(ruary\)\=\|Mar\%(ch\)\=\|Apr\%(il\)\=\|May\|June\=\|July\=\|Aug\%(ust\)\=\|Sep\%(tember\)\=\|Oct\%(ober\)\=\|Nov\%(ember\)\=\|Dec\%(ember\)\=\)\>/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifGoodMonth redifSpecial
|
||||
|
||||
@@ -774,46 +801,46 @@ highlight def link redifGoodMonth redifSpecial
|
||||
syntax match redifArgumentNumber /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectInteger contained display
|
||||
syntax match redifArgumentVolume /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectInteger contained display
|
||||
syntax match redifArgumentChapter /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectInteger contained display
|
||||
syntax match redifCorrectInteger /[1-9]\d*/ contained display
|
||||
syntax match redifCorrectInteger /[1-9]\d*/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentVolume redifError
|
||||
highlight def link redifArgumentChapter redifError
|
||||
|
||||
" Year
|
||||
syntax match redifArgumentYear /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectYear contained display
|
||||
syntax match redifCorrectYear /[1-9]\d\{3}/ contained display
|
||||
syntax match redifCorrectYear /[1-9]\d\{3}/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentYear redifError
|
||||
|
||||
" Edition
|
||||
" Based on the example in the documentation.
|
||||
syntax match redifArgumentEdition /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodEdition contained display
|
||||
syntax match redifGoodEdition /1st\|2nd\|3rd\|[4-9]th\|[1-9]\d*\%(1st\|2nd\|3rd\|[4-9]th\)\|[1-9]\d*/ contained display
|
||||
syntax match redifGoodEdition /1st\|2nd\|3rd\|[4-9]th\|[1-9]\d*\%(1st\|2nd\|3rd\|[4-9]th\)\|[1-9]\d*/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifGoodEdition redifSpecial
|
||||
|
||||
" ISBN
|
||||
syntax match redifArgumentISBN /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodISBN contained display
|
||||
syntax match redifGoodISBN /\d[0-9-]\{8,15}\d/ contained display
|
||||
syntax match redifGoodISBN /\d[0-9-]\{8,15}\d/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifGoodISBN redifSpecial
|
||||
|
||||
" ISSN
|
||||
syntax match redifArgumentISSN /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodISSN contained display
|
||||
syntax match redifGoodISSN /\d\{4}-\d\{3}[0-9X]/ contained display
|
||||
syntax match redifGoodISSN /\d\{4}-\d\{3}[0-9X]/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifGoodISSN redifSpecial
|
||||
|
||||
" File-Size
|
||||
" Based on the example in the documentation.
|
||||
syntax match redifArgumentFileSize /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodSize contained display
|
||||
syntax region redifArgumentFileSize start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=redifGoodSize contained
|
||||
syntax match redifGoodSize /kb\|bytes/ contained display
|
||||
|
||||
highlight def link redifGoodSize redifSpecial
|
||||
|
||||
" Type
|
||||
syntax match redifArgumentType /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectType contained display
|
||||
syntax match redifCorrectType /ReDIF-Paper\|ReDIF-Software\|ReDIF-Article\|ReDIF-Chapter\|ReDIF-Book/ contained display
|
||||
syntax match redifCorrectType /ReDIF-Paper\|ReDIF-Software\|ReDIF-Article\|ReDIF-Chapter\|ReDIF-Book/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentType redifError
|
||||
highlight def link redifCorrectType redifSpecial
|
||||
@@ -825,7 +852,7 @@ syntax match redifArgumentLastLoginDate /\%(^\S\{-}:\)\@!\S.*/ contains=redifCor
|
||||
syntax match redifArgumentPublicationDate /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectDate contained display
|
||||
syntax match redifArgumentRegisteredDate /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectDate contained display
|
||||
syntax match redifArgumentRevisionDate /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectDate contained display
|
||||
syntax match redifCorrectDate /[1-9]\d\{3}\%(-02\%(-[12]\d\|-0[1-9]\)\=\|-\%(0[469]\|11\)\%(-30\|-[12]\d\|-0[1-9]\)\=\|-\%(0[13578]\|1[02]\)\%(-3[01]\|-[12]\d\|-0[1-9]\)\=\)\=/ contained display
|
||||
syntax match redifCorrectDate /[1-9]\d\{3}\%(-02\%(-[12]\d\|-0[1-9]\)\=\|-\%(0[469]\|11\)\%(-30\|-[12]\d\|-0[1-9]\)\=\|-\%(0[13578]\|1[02]\)\%(-3[01]\|-[12]\d\|-0[1-9]\)\=\)\=/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentCreationDate redifError
|
||||
highlight def link redifArgumentLastLoginDate redifError
|
||||
@@ -835,7 +862,7 @@ highlight def link redifArgumentRevisionDate redifError
|
||||
|
||||
" Classification-JEL
|
||||
syntax match redifArgumentClassificationJEL /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectJEL contained display
|
||||
syntax match redifCorrectJEL /\<\u\d\{,2}\%([,; \t]\s*\)\=/ contains=redifSpecialJEL contained display
|
||||
syntax match redifCorrectJEL /\<\u\d\{,2}\%([,; \t]\s*\)\=/ contains=redifSpecialJEL nextgroup=redifWrongLineEnding contained display
|
||||
syntax match redifSpecialJEL /\<\u\d\{,2}/ contained display
|
||||
|
||||
highlight def link redifArgumentClassificationJEL redifError
|
||||
@@ -843,7 +870,7 @@ highlight def link redifSpecialJEL redifSpecial
|
||||
|
||||
" Pages
|
||||
syntax match redifArgumentPages /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectPages contained display
|
||||
syntax match redifCorrectPages /[1-9]\d*-[1-9]\d*/ contained display
|
||||
syntax match redifCorrectPages /[1-9]\d*-[1-9]\d*/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifArgumentPages redifError
|
||||
|
||||
@@ -855,7 +882,7 @@ highlight def link redifArgumentNameASCII redifError
|
||||
|
||||
" Programming-Language
|
||||
syntax match redifArgumentProgrammingLanguage /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodProgrammingLanguage contained display
|
||||
syntax match redifGoodProgrammingLanguage /\<c++\|\<\%(c\|dos executable\|executable\|fortran\|gauss\|gretl\|java\|mathematica\|matlab\|octave\|ox\|perl\|python\|rats\|r\|shazam\|s-plus\|stata\|tsp international\)\>/ contained display
|
||||
syntax match redifGoodProgrammingLanguage /\<c++\|\<\%(c\|dos executable\|executable\|fortran\|gauss\|gretl\|java\|mathematica\|matlab\|octave\|ox\|perl\|python\|rats\|r\|shazam\|s-plus\|stata\|tsp international\)\>/ nextgroup=redifWrongLineEnding contained display
|
||||
|
||||
highlight def link redifGoodProgrammingLanguage redifSpecial
|
||||
|
||||
@@ -864,29 +891,82 @@ highlight def link redifGoodProgrammingLanguage redifSpecial
|
||||
" ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types
|
||||
" These are based on the examples in the documentation.
|
||||
syntax match redifArgumentFileFormat /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodFormat contained display
|
||||
syntax match redifGoodFormat /application\/pdf\|application\/postscript\|text\/html\|text\/plain/ contained display
|
||||
syntax match redifGoodFormat "\a\+/[[:alpha:]+-]\+" nextgroup=redifWrongLineEnding contains=redifSpecialFormat contained display
|
||||
syntax match redifSpecialFormat "application/atom+xml\|application/ecmascript\|application/EDI-X12\|application/EDIFACT\|application/json\|application/javascript\|application/octet-stream\|application/ogg\|application/pdf\|application/postscript\|application/rdf+xml\|application/rss+xml\|application/soap+xml\|application/font-woff\|application/xhtml+xml\|application/xml\|application/xml-dtd\|application/xop+xml\|application/zip\|application/gzip\|audio/basic\|audio/L24\|audio/mp4\|audio/mpeg\|audio/ogg\|audio/vorbis\|audio/vnd.rn-realaudio\|audio/vnd.wave\|audio/webm\|image/gif\|image/jpeg\|image/pjpeg\|image/png\|image/svg+xml\|image/tiff\|image/vnd.microsoft.icon\|message/http\|message/imdn+xml\|message/partial\|message/rfc822\|model/example\|model/iges\|model/mesh\|model/vrml\|model/x3d+binary\|model/x3d+vrml\|model/x3d+xml\|multipart/mixed\|multipart/alternative\|multipart/related\|multipart/form-data\|multipart/signed\|multipart/encrypted\|text/cmd\|text/css\|text/csv\|text/html\|text/javascript\|text/plain\|text/vcard\|text/xml\|video/mpeg\|video/mp4\|video/ogg\|video/quicktime\|video/webm\|video/x-matroska\|video/x-ms-wmv\|video/x-flv" contained display
|
||||
|
||||
highlight def link redifGoodFormat redifSpecial
|
||||
highlight def link redifSpecialFormat redifSpecial
|
||||
highlight def link redifArgumentFileFormat redifError
|
||||
|
||||
" Spell-checked arguments
|
||||
" Keywords
|
||||
" Spell checked
|
||||
syntax match redifArgumentKeywords /\%(^\S\{-}:\)\@!\S.*/ contains=@Spell,redifKeywordsSemicolon contained
|
||||
syntax match redifKeywordsSemicolon /;/ contained
|
||||
|
||||
highlight def link redifKeywordsSemicolon redifSpecial
|
||||
|
||||
" Other spell-checked arguments
|
||||
" Very useful when copy-pasting abstracts that may contain hyphens or
|
||||
" ligatures.
|
||||
syntax region redifArgumentAbstract start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentAvailability start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentBookTitle start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentDescription start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentFileRestriction start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentKeywords start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentNote start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentNotification start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentRestriction start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentTitle start=/\%(^\S\{-}:\)\@!\S.*/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentAbstract start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentAvailability start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentBookTitle start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentDescription start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentFileRestriction start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentNote start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentNotification start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentRestriction start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
syntax region redifArgumentTitle start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contains=@Spell contained
|
||||
|
||||
" Wrong line ending
|
||||
syntax match redifWrongLineEnding /.\+/ contained display
|
||||
|
||||
highlight def link redifWrongLineEnding redifError
|
||||
|
||||
" Final highlight
|
||||
highlight def link redifComment Comment
|
||||
highlight def link redifError Error
|
||||
highlight def link redifField Identifier
|
||||
highlight def link redifFieldDeprecated Identifier
|
||||
highlight def link redifSpecial Special
|
||||
" For deprecated fields:
|
||||
highlight redifFieldDeprecated term=undercurl cterm=undercurl gui=undercurl guisp=DarkGrey
|
||||
|
||||
" Sync: The template-type (ReDIF-Paper, ReDIF-Archive, etc.) influences which
|
||||
" fields can follow. Thus sync must search backwards for it.
|
||||
"
|
||||
" I would like to simply ask VIM to search backward for the first occurence of
|
||||
" /^Template-Type:/, but it does not seem to be possible, so I have to start
|
||||
" from the beginning of the file... This might slow down a lot for files that
|
||||
" contain a lot of Template-Type statements.
|
||||
syntax sync fromstart
|
||||
|
||||
" The problem with syntax sync match (tried below), it is that, for example,
|
||||
" it cannot realize when it is inside a Author-Name cluster, which is inside a
|
||||
" Template-Type template...
|
||||
"
|
||||
" TODO Is this linecont pattern really useful? It seems to work anyway...
|
||||
"syntax sync linecont /^\(Template-Type:\)\=\s*$/
|
||||
" TODO This sync is surprising... It seems to work on several lines even
|
||||
" though I replaced \_s* by \s*, even without the linecont pattern...
|
||||
"syntax sync match redifSyncForTemplatePaper groupthere redifRegionTemplatePaper /^Template-Type:\s*ReDIF-Paper \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateArticle groupthere redifRegionTemplateArticle /^Template-Type:\s*ReDIF-Article \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateChapter groupthere redifRegionTemplateChapter /^Template-Type:\s*ReDIF-Chapter \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateBook groupthere redifRegionTemplateBook /^Template-Type:\s*ReDIF-Book \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateSoftware groupthere redifRegionTemplateSoftware /^Template-Type:\s*ReDIF-Software \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateArchive groupthere redifRegionTemplateArchive /^Template-Type:\s*ReDIF-Archive \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateSeries groupthere redifRegionTemplateSeries /^Template-Type:\s*ReDIF-Series \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplateInstitution groupthere redifRegionTemplateInstitution /^Template-Type:\s*ReDIF-Institution \d\+\.\d\+/
|
||||
"syntax sync match redifSyncForTemplatePerson groupthere redifRegionTemplatePerson /^Template-Type:\s*ReDIF-Person \d\+\.\d\+/
|
||||
|
||||
" I do not really know how sync linebreaks works, but it helps when making
|
||||
" changes on the argument when this argument is not on the same line than its
|
||||
" field. I just assume that people won't leave more than one line of
|
||||
" whitespace between fields and arguments (which is already very unlikely)
|
||||
" hence the value of 2.
|
||||
syntax sync linebreaks=2
|
||||
|
||||
" Since folding is defined by the syntax, set foldmethod to syntax.
|
||||
set foldmethod=syntax
|
||||
|
||||
" Set "b:current_syntax" to the name of the syntax at the end:
|
||||
let b:current_syntax="redif"
|
||||
23
src/auto/configure
vendored
23
src/auto/configure
vendored
@@ -4737,15 +4737,24 @@ $as_echo "no" >&6; }
|
||||
if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
|
||||
vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
|
||||
else
|
||||
for LUA_SOVER in "${vi_cv_version_lua}.so" ".so.${vi_cv_version_lua}"; do
|
||||
for i in 0 1 2 3 4 5 6 7 8 9; do
|
||||
if test -f "${vi_cv_path_lua_pfx}/lib/liblua${LUA_SOVER}.$i"; then
|
||||
LUA_SONAME=".$i"
|
||||
break
|
||||
fi
|
||||
multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
|
||||
if test "X$multiarch" != "X"; then
|
||||
lib_multiarch="lib/${multiarch}"
|
||||
fi
|
||||
for subdir in "${lib_multiarch}" lib64 lib; do
|
||||
if test -z "$subdir"; then
|
||||
continue
|
||||
fi
|
||||
for sover in "${vi_cv_version_lua}.so" "-${vi_cv_version_lua}.so" ".so.${vi_cv_version_lua}"; do
|
||||
for i in .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 ""; do
|
||||
if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${sover}$i"; then
|
||||
sover2="$i"
|
||||
break 3
|
||||
fi
|
||||
done
|
||||
done
|
||||
vi_cv_dll_name_lua="liblua${LUA_SOVER}$LUA_SONAME"
|
||||
done
|
||||
vi_cv_dll_name_lua="liblua${sover}$sover2"
|
||||
fi
|
||||
$as_echo "#define DYNAMIC_LUA 1" >>confdefs.h
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
:: command to build big Vim with OLE, Perl, Python, Ruby and Tcl
|
||||
SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\"
|
||||
SET TOOLDIR=E:\
|
||||
%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes PERL=E:\perl514 DYNAMIC_PERL=yes PERL_VER=514 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python32 DYNAMIC_PYTHON3=yes PYTHON3_VER=32 RUBY=%TOOLDIR%ruby192 DYNAMIC_RUBY=yes RUBY_VER=192 RUBY_VER_LONG=1.9.2 TCL=%TOOLDIR%tcl TCL_VER=85 TCL_VER_LONG=8.5 DYNAMIC_TCL=yes %1 IME=yes CSCOPE=yes
|
||||
%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes PERL=E:\perl514 DYNAMIC_PERL=yes PERL_VER=514 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python32 DYNAMIC_PYTHON3=yes PYTHON3_VER=32 RUBY=%TOOLDIR%ruby192 DYNAMIC_RUBY=yes RUBY_VER=19 RUBY_VER_LONG=1.9.2 TCL=%TOOLDIR%tcl TCL_VER=85 TCL_VER_LONG=8.5 DYNAMIC_TCL=yes %1 IME=yes CSCOPE=yes
|
||||
|
||||
|
||||
22
src/buffer.c
22
src/buffer.c
@@ -648,6 +648,9 @@ free_buffer(buf)
|
||||
buf_T *buf;
|
||||
{
|
||||
free_buffer_stuff(buf, TRUE);
|
||||
#ifdef FEAT_EVAL
|
||||
unref_var_dict(buf->b_vars);
|
||||
#endif
|
||||
#ifdef FEAT_LUA
|
||||
lua_buffer_free(buf);
|
||||
#endif
|
||||
@@ -689,8 +692,8 @@ free_buffer_stuff(buf, free_options)
|
||||
#endif
|
||||
}
|
||||
#ifdef FEAT_EVAL
|
||||
vars_clear(&buf->b_vars.dv_hashtab); /* free all internal variables */
|
||||
hash_init(&buf->b_vars.dv_hashtab);
|
||||
vars_clear(&buf->b_vars->dv_hashtab); /* free all internal variables */
|
||||
hash_init(&buf->b_vars->dv_hashtab);
|
||||
#endif
|
||||
#ifdef FEAT_USR_CMDS
|
||||
uc_clear(&buf->b_ucmds); /* clear local user commands */
|
||||
@@ -1694,6 +1697,17 @@ buflist_new(ffname, sfname, lnum, flags)
|
||||
vim_free(ffname);
|
||||
return NULL;
|
||||
}
|
||||
#ifdef FEAT_EVAL
|
||||
/* init b: variables */
|
||||
buf->b_vars = dict_alloc();
|
||||
if (buf->b_vars == NULL)
|
||||
{
|
||||
vim_free(ffname);
|
||||
vim_free(buf);
|
||||
return NULL;
|
||||
}
|
||||
init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ffname != NULL)
|
||||
@@ -1778,10 +1792,6 @@ buflist_new(ffname, sfname, lnum, flags)
|
||||
buf->b_wininfo->wi_fpos.lnum = lnum;
|
||||
buf->b_wininfo->wi_win = curwin;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
/* init b: variables */
|
||||
init_var_dict(&buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
|
||||
#endif
|
||||
#ifdef FEAT_SYN_HL
|
||||
hash_init(&buf->b_s.b_keywtab);
|
||||
hash_init(&buf->b_s.b_keywtab_ic);
|
||||
|
||||
@@ -494,17 +494,26 @@ if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
|
||||
if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
|
||||
vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
|
||||
else
|
||||
dnl Determine the SONAME for the current version, but fallback to
|
||||
dnl liblua${vi_cv_version_lua}.so if no SONAME-versioned file is found.
|
||||
for LUA_SOVER in "${vi_cv_version_lua}.so" ".so.${vi_cv_version_lua}"; do
|
||||
for i in 0 1 2 3 4 5 6 7 8 9; do
|
||||
if test -f "${vi_cv_path_lua_pfx}/lib/liblua${LUA_SOVER}.$i"; then
|
||||
LUA_SONAME=".$i"
|
||||
break
|
||||
fi
|
||||
multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
|
||||
if test "X$multiarch" != "X"; then
|
||||
lib_multiarch="lib/${multiarch}"
|
||||
fi
|
||||
dnl Determine the sover for the current version, but fallback to
|
||||
dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
|
||||
for subdir in "${lib_multiarch}" lib64 lib; do
|
||||
if test -z "$subdir"; then
|
||||
continue
|
||||
fi
|
||||
for sover in "${vi_cv_version_lua}.so" "-${vi_cv_version_lua}.so" ".so.${vi_cv_version_lua}"; do
|
||||
for i in .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 ""; do
|
||||
if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${sover}$i"; then
|
||||
sover2="$i"
|
||||
break 3
|
||||
fi
|
||||
done
|
||||
done
|
||||
vi_cv_dll_name_lua="liblua${LUA_SOVER}$LUA_SONAME"
|
||||
done
|
||||
vi_cv_dll_name_lua="liblua${sover}$sover2"
|
||||
fi
|
||||
AC_DEFINE(DYNAMIC_LUA)
|
||||
LUA_LIBS=""
|
||||
|
||||
135
src/eval.c
135
src/eval.c
@@ -788,7 +788,7 @@ static char_u *get_tv_string __ARGS((typval_T *varp));
|
||||
static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
|
||||
static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
|
||||
static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
|
||||
static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, char_u *varname, int writing));
|
||||
static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int writing));
|
||||
static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
|
||||
static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
|
||||
static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
|
||||
@@ -2131,7 +2131,7 @@ list_buf_vars(first)
|
||||
{
|
||||
char_u numbuf[NUMBUFLEN];
|
||||
|
||||
list_hashtable_vars(&curbuf->b_vars.dv_hashtab, (char_u *)"b:",
|
||||
list_hashtable_vars(&curbuf->b_vars->dv_hashtab, (char_u *)"b:",
|
||||
TRUE, first);
|
||||
|
||||
sprintf((char *)numbuf, "%ld", (long)curbuf->b_changedtick);
|
||||
@@ -2146,7 +2146,7 @@ list_buf_vars(first)
|
||||
list_win_vars(first)
|
||||
int *first;
|
||||
{
|
||||
list_hashtable_vars(&curwin->w_vars.dv_hashtab,
|
||||
list_hashtable_vars(&curwin->w_vars->dv_hashtab,
|
||||
(char_u *)"w:", TRUE, first);
|
||||
}
|
||||
|
||||
@@ -2158,7 +2158,7 @@ list_win_vars(first)
|
||||
list_tab_vars(first)
|
||||
int *first;
|
||||
{
|
||||
list_hashtable_vars(&curtab->tp_vars.dv_hashtab,
|
||||
list_hashtable_vars(&curtab->tp_vars->dv_hashtab,
|
||||
(char_u *)"t:", TRUE, first);
|
||||
}
|
||||
#endif
|
||||
@@ -3948,7 +3948,7 @@ get_user_var_name(xp, idx)
|
||||
}
|
||||
|
||||
/* b: variables */
|
||||
ht = &curbuf->b_vars.dv_hashtab;
|
||||
ht = &curbuf->b_vars->dv_hashtab;
|
||||
if (bdone < ht->ht_used)
|
||||
{
|
||||
if (bdone++ == 0)
|
||||
@@ -3966,7 +3966,7 @@ get_user_var_name(xp, idx)
|
||||
}
|
||||
|
||||
/* w: variables */
|
||||
ht = &curwin->w_vars.dv_hashtab;
|
||||
ht = &curwin->w_vars->dv_hashtab;
|
||||
if (wdone < ht->ht_used)
|
||||
{
|
||||
if (wdone++ == 0)
|
||||
@@ -3980,7 +3980,7 @@ get_user_var_name(xp, idx)
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
/* t: variables */
|
||||
ht = &curtab->tp_vars.dv_hashtab;
|
||||
ht = &curtab->tp_vars->dv_hashtab;
|
||||
if (tdone < ht->ht_used)
|
||||
{
|
||||
if (tdone++ == 0)
|
||||
@@ -6787,16 +6787,20 @@ garbage_collect()
|
||||
|
||||
/* buffer-local variables */
|
||||
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
||||
set_ref_in_ht(&buf->b_vars.dv_hashtab, copyID);
|
||||
set_ref_in_item(&buf->b_bufvar.di_tv, copyID);
|
||||
|
||||
/* window-local variables */
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||
set_ref_in_ht(&wp->w_vars.dv_hashtab, copyID);
|
||||
set_ref_in_item(&wp->w_winvar.di_tv, copyID);
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (aucmd_win != NULL)
|
||||
set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
/* tabpage-local variables */
|
||||
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
|
||||
set_ref_in_ht(&tp->tp_vars.dv_hashtab, copyID);
|
||||
set_ref_in_item(&tp->tp_winvar.di_tv, copyID);
|
||||
#endif
|
||||
|
||||
/* global variables */
|
||||
@@ -11120,20 +11124,15 @@ f_getbufvar(argvars, rettv)
|
||||
buf_T *save_curbuf;
|
||||
char_u *varname;
|
||||
dictitem_T *v;
|
||||
int done = FALSE;
|
||||
|
||||
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
|
||||
varname = get_tv_string_chk(&argvars[1]);
|
||||
++emsg_off;
|
||||
buf = get_buf_tv(&argvars[0], FALSE);
|
||||
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
/* set the default value */
|
||||
copy_tv(&argvars[2], rettv);
|
||||
else
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
}
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
if (buf != NULL && varname != NULL)
|
||||
{
|
||||
@@ -11142,29 +11141,37 @@ f_getbufvar(argvars, rettv)
|
||||
curbuf = buf;
|
||||
|
||||
if (*varname == '&') /* buffer-local-option */
|
||||
get_option_tv(&varname, rettv, TRUE);
|
||||
{
|
||||
if (get_option_tv(&varname, rettv, TRUE) == OK)
|
||||
done = TRUE;
|
||||
}
|
||||
else if (STRCMP(varname, "changedtick") == 0)
|
||||
{
|
||||
rettv->v_type = VAR_NUMBER;
|
||||
rettv->vval.v_number = curbuf->b_changedtick;
|
||||
done = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*varname == NUL)
|
||||
/* let getbufvar({nr}, "") return the "b:" dictionary. The
|
||||
* scope prefix before the NUL byte is required by
|
||||
* find_var_in_ht(). */
|
||||
varname = (char_u *)"b:" + 2;
|
||||
/* look up the variable */
|
||||
v = find_var_in_ht(&curbuf->b_vars.dv_hashtab, varname, FALSE);
|
||||
/* Look up the variable. */
|
||||
/* Let getbufvar({nr}, "") return the "b:" dictionary. */
|
||||
v = find_var_in_ht(&curbuf->b_vars->dv_hashtab,
|
||||
'b', varname, FALSE);
|
||||
if (v != NULL)
|
||||
{
|
||||
copy_tv(&v->di_tv, rettv);
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* restore previous notion of curbuf */
|
||||
curbuf = save_curbuf;
|
||||
}
|
||||
|
||||
if (!done && argvars[2].v_type != VAR_UNKNOWN)
|
||||
/* use the default value */
|
||||
copy_tv(&argvars[2], rettv);
|
||||
|
||||
--emsg_off;
|
||||
}
|
||||
|
||||
@@ -11770,6 +11777,7 @@ f_gettabvar(argvars, rettv)
|
||||
tabpage_T *tp;
|
||||
dictitem_T *v;
|
||||
char_u *varname;
|
||||
int done = FALSE;
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
@@ -11779,13 +11787,15 @@ f_gettabvar(argvars, rettv)
|
||||
if (tp != NULL && varname != NULL)
|
||||
{
|
||||
/* look up the variable */
|
||||
v = find_var_in_ht(&tp->tp_vars.dv_hashtab, varname, FALSE);
|
||||
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE);
|
||||
if (v != NULL)
|
||||
{
|
||||
copy_tv(&v->di_tv, rettv);
|
||||
else if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
copy_tv(&argvars[2], rettv);
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
else if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
|
||||
if (!done && argvars[2].v_type != VAR_UNKNOWN)
|
||||
copy_tv(&argvars[2], rettv);
|
||||
}
|
||||
|
||||
@@ -11897,6 +11907,7 @@ getwinvar(argvars, rettv, off)
|
||||
char_u *varname;
|
||||
dictitem_T *v;
|
||||
tabpage_T *tp;
|
||||
int done = FALSE;
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
if (off == 1)
|
||||
@@ -11908,14 +11919,8 @@ getwinvar(argvars, rettv, off)
|
||||
varname = get_tv_string_chk(&argvars[off + 1]);
|
||||
++emsg_off;
|
||||
|
||||
if (argvars[off + 2].v_type != VAR_UNKNOWN)
|
||||
/* set the default return value */
|
||||
copy_tv(&argvars[off + 2], rettv);
|
||||
else
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
}
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
if (win != NULL && varname != NULL)
|
||||
{
|
||||
@@ -11926,18 +11931,20 @@ getwinvar(argvars, rettv, off)
|
||||
curbuf = win->w_buffer;
|
||||
|
||||
if (*varname == '&') /* window-local-option */
|
||||
get_option_tv(&varname, rettv, 1);
|
||||
{
|
||||
if (get_option_tv(&varname, rettv, 1) == OK)
|
||||
done = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*varname == NUL)
|
||||
/* let getwinvar({nr}, "") return the "w:" dictionary. The
|
||||
* scope prefix before the NUL byte is required by
|
||||
* find_var_in_ht(). */
|
||||
varname = (char_u *)"w:" + 2;
|
||||
/* look up the variable */
|
||||
v = find_var_in_ht(&win->w_vars.dv_hashtab, varname, FALSE);
|
||||
/* Look up the variable. */
|
||||
/* Let getwinvar({nr}, "") return the "w:" dictionary. */
|
||||
v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE);
|
||||
if (v != NULL)
|
||||
{
|
||||
copy_tv(&v->di_tv, rettv);
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* restore previous notion of curwin */
|
||||
@@ -11945,6 +11952,10 @@ getwinvar(argvars, rettv, off)
|
||||
curbuf = curwin->w_buffer;
|
||||
}
|
||||
|
||||
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
|
||||
/* use the default return value */
|
||||
copy_tv(&argvars[off + 2], rettv);
|
||||
|
||||
--emsg_off;
|
||||
}
|
||||
|
||||
@@ -14333,7 +14344,7 @@ f_mode(argvars, rettv)
|
||||
rettv->v_type = VAR_STRING;
|
||||
}
|
||||
|
||||
#ifdef FEAT_MZSCHEME
|
||||
#if defined(FEAT_MZSCHEME) || defined(PROTO)
|
||||
/*
|
||||
* "mzeval()" function
|
||||
*/
|
||||
@@ -20041,16 +20052,17 @@ find_var(name, htp)
|
||||
*htp = ht;
|
||||
if (ht == NULL)
|
||||
return NULL;
|
||||
return find_var_in_ht(ht, varname, htp != NULL);
|
||||
return find_var_in_ht(ht, *name, varname, htp != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find variable "varname" in hashtab "ht".
|
||||
* Find variable "varname" in hashtab "ht" with name "htname".
|
||||
* Returns NULL if not found.
|
||||
*/
|
||||
static dictitem_T *
|
||||
find_var_in_ht(ht, varname, writing)
|
||||
find_var_in_ht(ht, htname, varname, writing)
|
||||
hashtab_T *ht;
|
||||
int htname;
|
||||
char_u *varname;
|
||||
int writing;
|
||||
{
|
||||
@@ -20059,7 +20071,7 @@ find_var_in_ht(ht, varname, writing)
|
||||
if (*varname == NUL)
|
||||
{
|
||||
/* Must be something like "s:", otherwise "ht" would be NULL. */
|
||||
switch (varname[-2])
|
||||
switch (htname)
|
||||
{
|
||||
case 's': return &SCRIPT_SV(current_SID)->sv_var;
|
||||
case 'g': return &globvars_var;
|
||||
@@ -20134,12 +20146,12 @@ find_var_ht(name, varname)
|
||||
|| vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL)
|
||||
return NULL;
|
||||
if (*name == 'b') /* buffer variable */
|
||||
return &curbuf->b_vars.dv_hashtab;
|
||||
return &curbuf->b_vars->dv_hashtab;
|
||||
if (*name == 'w') /* window variable */
|
||||
return &curwin->w_vars.dv_hashtab;
|
||||
return &curwin->w_vars->dv_hashtab;
|
||||
#ifdef FEAT_WINDOWS
|
||||
if (*name == 't') /* tab page variable */
|
||||
return &curtab->tp_vars.dv_hashtab;
|
||||
return &curtab->tp_vars->dv_hashtab;
|
||||
#endif
|
||||
if (*name == 'v') /* v: variable */
|
||||
return &vimvarht;
|
||||
@@ -20228,6 +20240,19 @@ init_var_dict(dict, dict_var, scope)
|
||||
dict_var->di_key[0] = NUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unreference a dictionary initialized by init_var_dict().
|
||||
*/
|
||||
void
|
||||
unref_var_dict(dict)
|
||||
dict_T *dict;
|
||||
{
|
||||
/* Now the dict needs to be freed if no one else is using it, go back to
|
||||
* normal reference counting. */
|
||||
dict->dv_refcount -= DO_NOT_FREE_CNT - 1;
|
||||
dict_unref(dict);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up a list of internal variables.
|
||||
* Frees all allocated variables and the value they contain.
|
||||
@@ -20376,7 +20401,7 @@ set_var(name, tv, copy)
|
||||
EMSG2(_(e_illvar), name);
|
||||
return;
|
||||
}
|
||||
v = find_var_in_ht(ht, varname, TRUE);
|
||||
v = find_var_in_ht(ht, 0, varname, TRUE);
|
||||
|
||||
if (tv->v_type == VAR_FUNC && var_check_func_name(name, v == NULL))
|
||||
return;
|
||||
|
||||
@@ -2113,7 +2113,7 @@ read_viminfo_up_to_marks(virp, forceit, writing)
|
||||
buf_T *buf;
|
||||
|
||||
#ifdef FEAT_CMDHIST
|
||||
prepare_viminfo_history(forceit ? 9999 : 0);
|
||||
prepare_viminfo_history(forceit ? 9999 : 0, writing);
|
||||
#endif
|
||||
eof = viminfo_readline(virp);
|
||||
while (!eof && virp->vir_line[0] != '>')
|
||||
@@ -2161,7 +2161,7 @@ read_viminfo_up_to_marks(virp, forceit, writing)
|
||||
case '=':
|
||||
case '@':
|
||||
#ifdef FEAT_CMDHIST
|
||||
eof = read_viminfo_history(virp);
|
||||
eof = read_viminfo_history(virp, writing);
|
||||
#else
|
||||
eof = viminfo_readline(virp);
|
||||
#endif
|
||||
@@ -2182,7 +2182,8 @@ read_viminfo_up_to_marks(virp, forceit, writing)
|
||||
|
||||
#ifdef FEAT_CMDHIST
|
||||
/* Finish reading history items. */
|
||||
finish_viminfo_history();
|
||||
if (!writing)
|
||||
finish_viminfo_history();
|
||||
#endif
|
||||
|
||||
/* Change file names to buffer numbers for fmarks. */
|
||||
|
||||
@@ -68,7 +68,7 @@ static int hislen = 0; /* actual length of history tables */
|
||||
|
||||
static int hist_char2type __ARGS((int c));
|
||||
|
||||
static int in_history __ARGS((int, char_u *, int, int));
|
||||
static int in_history __ARGS((int, char_u *, int, int, int));
|
||||
# ifdef FEAT_EVAL
|
||||
static int calc_hist_idx __ARGS((int histype, int num));
|
||||
# endif
|
||||
@@ -5397,11 +5397,12 @@ clear_hist_entry(hisptr)
|
||||
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
|
||||
*/
|
||||
static int
|
||||
in_history(type, str, move_to_front, sep)
|
||||
in_history(type, str, move_to_front, sep, writing)
|
||||
int type;
|
||||
char_u *str;
|
||||
int move_to_front; /* Move the entry to the front if it exists */
|
||||
int sep;
|
||||
int writing; /* ignore entries read from viminfo */
|
||||
{
|
||||
int i;
|
||||
int last_i = -1;
|
||||
@@ -5419,6 +5420,7 @@ in_history(type, str, move_to_front, sep)
|
||||
* well. */
|
||||
p = history[type][i].hisstr;
|
||||
if (STRCMP(str, p) == 0
|
||||
&& !(writing && history[type][i].viminfo)
|
||||
&& (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
|
||||
{
|
||||
if (!move_to_front)
|
||||
@@ -5513,7 +5515,7 @@ add_to_history(histype, new_entry, in_map, sep)
|
||||
}
|
||||
last_maptick = -1;
|
||||
}
|
||||
if (!in_history(histype, new_entry, TRUE, sep))
|
||||
if (!in_history(histype, new_entry, TRUE, sep, FALSE))
|
||||
{
|
||||
if (++hisidx[histype] == hislen)
|
||||
hisidx[histype] = 0;
|
||||
@@ -6032,8 +6034,9 @@ hist_type2char(type, use_question)
|
||||
* This allocates history arrays to store the read history lines.
|
||||
*/
|
||||
void
|
||||
prepare_viminfo_history(asklen)
|
||||
prepare_viminfo_history(asklen, writing)
|
||||
int asklen;
|
||||
int writing;
|
||||
{
|
||||
int i;
|
||||
int num;
|
||||
@@ -6041,7 +6044,7 @@ prepare_viminfo_history(asklen)
|
||||
int len;
|
||||
|
||||
init_history();
|
||||
viminfo_add_at_front = (asklen != 0);
|
||||
viminfo_add_at_front = (asklen != 0 && !writing);
|
||||
if (asklen > hislen)
|
||||
asklen = hislen;
|
||||
|
||||
@@ -6073,8 +6076,9 @@ prepare_viminfo_history(asklen)
|
||||
* new.
|
||||
*/
|
||||
int
|
||||
read_viminfo_history(virp)
|
||||
read_viminfo_history(virp, writing)
|
||||
vir_T *virp;
|
||||
int writing;
|
||||
{
|
||||
int type;
|
||||
long_u len;
|
||||
@@ -6090,7 +6094,7 @@ read_viminfo_history(virp)
|
||||
int sep = (*val == ' ' ? NUL : *val);
|
||||
|
||||
if (!in_history(type, val + (type == HIST_SEARCH),
|
||||
viminfo_add_at_front, sep))
|
||||
viminfo_add_at_front, sep, writing))
|
||||
{
|
||||
/* Need to re-allocate to append the separator byte. */
|
||||
len = STRLEN(val);
|
||||
@@ -6120,6 +6124,9 @@ read_viminfo_history(virp)
|
||||
return viminfo_readline(virp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Finish reading history lines from viminfo. Not used when writing viminfo.
|
||||
*/
|
||||
void
|
||||
finish_viminfo_history()
|
||||
{
|
||||
@@ -6130,7 +6137,7 @@ finish_viminfo_history()
|
||||
for (type = 0; type < HIST_COUNT; ++type)
|
||||
{
|
||||
if (history[type] == NULL)
|
||||
return;
|
||||
continue;
|
||||
idx = hisidx[type] + viminfo_hisidx[type];
|
||||
if (idx >= hislen)
|
||||
idx -= hislen;
|
||||
@@ -6182,6 +6189,7 @@ write_viminfo_history(fp)
|
||||
int num_saved;
|
||||
char_u *p;
|
||||
int c;
|
||||
int round;
|
||||
|
||||
init_history();
|
||||
if (hislen == 0)
|
||||
@@ -6200,26 +6208,63 @@ write_viminfo_history(fp)
|
||||
_("Input Line"));
|
||||
if (num_saved > hislen)
|
||||
num_saved = hislen;
|
||||
i = hisidx[type];
|
||||
if (i >= 0)
|
||||
while (num_saved--)
|
||||
{
|
||||
p = history[type][i].hisstr;
|
||||
if (p != NULL)
|
||||
|
||||
/*
|
||||
* Merge typed and viminfo history:
|
||||
* round 1: history of typed commands.
|
||||
* round 2: history from recently read viminfo.
|
||||
*/
|
||||
for (round = 1; round <= 2; ++round)
|
||||
{
|
||||
if (round == 1)
|
||||
/* start at newest entry, somewhere in the list */
|
||||
i = hisidx[type];
|
||||
else if (viminfo_hisidx[type] > 0)
|
||||
/* start at newest entry, first in the list */
|
||||
i = 0;
|
||||
else
|
||||
/* empty list */
|
||||
i = -1;
|
||||
if (i >= 0)
|
||||
while (num_saved > 0
|
||||
&& !(round == 2 && i >= viminfo_hisidx[type]))
|
||||
{
|
||||
fputc(hist_type2char(type, TRUE), fp);
|
||||
/* For the search history: put the separator in the second
|
||||
* column; use a space if there isn't one. */
|
||||
if (type == HIST_SEARCH)
|
||||
p = round == 1 ? history[type][i].hisstr
|
||||
: viminfo_history[type][i];
|
||||
if (p != NULL && (round == 2 || !history[type][i].viminfo))
|
||||
{
|
||||
c = p[STRLEN(p) + 1];
|
||||
putc(c == NUL ? ' ' : c, fp);
|
||||
--num_saved;
|
||||
fputc(hist_type2char(type, TRUE), fp);
|
||||
/* For the search history: put the separator in the
|
||||
* second column; use a space if there isn't one. */
|
||||
if (type == HIST_SEARCH)
|
||||
{
|
||||
c = p[STRLEN(p) + 1];
|
||||
putc(c == NUL ? ' ' : c, fp);
|
||||
}
|
||||
viminfo_writestring(fp, p);
|
||||
}
|
||||
if (round == 1)
|
||||
{
|
||||
/* Decrement index, loop around and stop when back at
|
||||
* the start. */
|
||||
if (--i < 0)
|
||||
i = hislen - 1;
|
||||
if (i == hisidx[type])
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Increment index. Stop at the end in the while. */
|
||||
++i;
|
||||
}
|
||||
viminfo_writestring(fp, p);
|
||||
}
|
||||
if (--i < 0)
|
||||
i = hislen - 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < viminfo_hisidx[type]; ++i)
|
||||
vim_free(viminfo_history[type][i]);
|
||||
vim_free(viminfo_history[type]);
|
||||
viminfo_history[type] = NULL;
|
||||
viminfo_hisidx[type] = 0;
|
||||
}
|
||||
}
|
||||
#endif /* FEAT_VIMINFO */
|
||||
|
||||
@@ -1088,6 +1088,13 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note: Only one of the following may be defined:
|
||||
* FEAT_MOUSE_GPM
|
||||
* FEAT_SYSMOUSE
|
||||
* FEAT_MOUSE_JSB
|
||||
* FEAT_MOUSE_PTERM
|
||||
*/
|
||||
#if defined(FEAT_NORMAL) && defined(HAVE_GPM)
|
||||
# define FEAT_MOUSE_GPM
|
||||
#endif
|
||||
|
||||
@@ -8955,8 +8955,8 @@ win_found:
|
||||
/* Hmm, original window disappeared. Just use the first one. */
|
||||
curwin = firstwin;
|
||||
# ifdef FEAT_EVAL
|
||||
vars_clear(&aucmd_win->w_vars.dv_hashtab); /* free all w: variables */
|
||||
hash_init(&aucmd_win->w_vars.dv_hashtab); /* re-use the hashtab */
|
||||
vars_clear(&aucmd_win->w_vars->dv_hashtab); /* free all w: variables */
|
||||
hash_init(&aucmd_win->w_vars->dv_hashtab); /* re-use the hashtab */
|
||||
# endif
|
||||
#else
|
||||
curwin = aco->save_curwin;
|
||||
|
||||
@@ -444,7 +444,7 @@ flush_buffers(flush_typeahead)
|
||||
typebuf.tb_off = MAXMAPLEN;
|
||||
typebuf.tb_len = 0;
|
||||
}
|
||||
else /* remove mapped characters only */
|
||||
else /* remove mapped characters at the start only */
|
||||
{
|
||||
typebuf.tb_off += typebuf.tb_maplen;
|
||||
typebuf.tb_len -= typebuf.tb_maplen;
|
||||
|
||||
43
src/if_lua.c
43
src/if_lua.c
@@ -664,13 +664,6 @@ luaV_newlist (lua_State *L, list_T *lis)
|
||||
luaV_pushtype(list_T, list, luaV_List)
|
||||
luaV_type_tostring(list, LUAVIM_LIST)
|
||||
|
||||
static int
|
||||
luaV_list_gc (lua_State *L)
|
||||
{
|
||||
list_unref(luaV_unbox(L, luaV_List, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
luaV_list_len (lua_State *L)
|
||||
{
|
||||
@@ -716,8 +709,7 @@ luaV_list_index (lua_State *L)
|
||||
{
|
||||
const char *s = lua_tostring(L, 2);
|
||||
if (strncmp(s, "add", 3) == 0
|
||||
|| strncmp(s, "insert", 6) == 0
|
||||
|| strncmp(s, "extend", 6) == 0)
|
||||
|| strncmp(s, "insert", 6) == 0)
|
||||
{
|
||||
lua_getmetatable(L, 1);
|
||||
lua_getfield(L, -1, s);
|
||||
@@ -752,6 +744,7 @@ luaV_list_newindex (lua_State *L)
|
||||
luaV_totypval(L, 3, &v);
|
||||
clear_tv(&li->li_tv);
|
||||
copy_tv(&v, &li->li_tv);
|
||||
clear_tv(&v);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -761,17 +754,17 @@ luaV_list_add (lua_State *L)
|
||||
{
|
||||
luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST);
|
||||
list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis);
|
||||
listitem_T *li;
|
||||
typval_T v;
|
||||
if (l->lv_lock)
|
||||
luaL_error(L, "list is locked");
|
||||
li = listitem_alloc();
|
||||
if (li != NULL)
|
||||
lua_settop(L, 2);
|
||||
luaV_totypval(L, 2, &v);
|
||||
if (list_append_tv(l, &v) == FAIL)
|
||||
{
|
||||
typval_T v;
|
||||
lua_settop(L, 2);
|
||||
luaV_totypval(L, 2, &v);
|
||||
list_append_tv(l, &v);
|
||||
clear_tv(&v);
|
||||
luaL_error(L, "Failed to add item to list");
|
||||
}
|
||||
clear_tv(&v);
|
||||
lua_settop(L, 1);
|
||||
return 1;
|
||||
}
|
||||
@@ -794,14 +787,18 @@ luaV_list_insert (lua_State *L)
|
||||
}
|
||||
lua_settop(L, 2);
|
||||
luaV_totypval(L, 2, &v);
|
||||
list_insert_tv(l, &v, li);
|
||||
if (list_insert_tv(l, &v, li) == FAIL)
|
||||
{
|
||||
clear_tv(&v);
|
||||
luaL_error(L, "Failed to add item to list");
|
||||
}
|
||||
clear_tv(&v);
|
||||
lua_settop(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg luaV_List_mt[] = {
|
||||
{"__tostring", luaV_list_tostring},
|
||||
{"__gc", luaV_list_gc},
|
||||
{"__len", luaV_list_len},
|
||||
{"__call", luaV_list_call},
|
||||
{"__index", luaV_list_index},
|
||||
@@ -829,13 +826,6 @@ luaV_newdict (lua_State *L, dict_T *dic)
|
||||
luaV_pushtype(dict_T, dict, luaV_Dict)
|
||||
luaV_type_tostring(dict, LUAVIM_DICT)
|
||||
|
||||
static int
|
||||
luaV_dict_gc (lua_State *L)
|
||||
{
|
||||
dict_unref(luaV_unbox(L, luaV_Dict, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
luaV_dict_len (lua_State *L)
|
||||
{
|
||||
@@ -923,13 +913,13 @@ luaV_dict_newindex (lua_State *L)
|
||||
typval_T v;
|
||||
luaV_totypval(L, 3, &v);
|
||||
copy_tv(&v, &di->di_tv);
|
||||
clear_tv(&v);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const luaL_Reg luaV_Dict_mt[] = {
|
||||
{"__tostring", luaV_dict_tostring},
|
||||
{"__gc", luaV_dict_gc},
|
||||
{"__len", luaV_dict_len},
|
||||
{"__call", luaV_dict_call},
|
||||
{"__index", luaV_dict_index},
|
||||
@@ -1339,6 +1329,7 @@ luaV_eval(lua_State *L)
|
||||
typval_T *tv = eval_expr((char_u *) luaL_checkstring(L, 1), NULL);
|
||||
if (tv == NULL) luaL_error(L, "invalid expression");
|
||||
luaV_pushtypval(L, tv);
|
||||
free_tv(tv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
459
src/if_py_both.h
459
src/if_py_both.h
@@ -542,6 +542,14 @@ typedef struct
|
||||
* Buffer list object - Implementation
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} BufListObject;
|
||||
|
||||
static PyTypeObject BufListType;
|
||||
static PySequenceMethods WinListAsSeq;
|
||||
|
||||
static PyInt
|
||||
BufListLength(PyObject *self UNUSED)
|
||||
{
|
||||
@@ -578,6 +586,11 @@ typedef struct
|
||||
win_T *win;
|
||||
} WindowObject;
|
||||
|
||||
static struct PyMethodDef WindowMethods[] = {
|
||||
/* name, function, calling, documentation */
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
static int ConvertFromPyObject(PyObject *, typval_T *);
|
||||
static int _ConvertFromPyObject(PyObject *, typval_T *, PyObject *);
|
||||
|
||||
@@ -642,6 +655,16 @@ typedef struct
|
||||
pylinkedlist_T ref;
|
||||
} DictionaryObject;
|
||||
|
||||
static PyInt DictionaryAssItem(PyObject *, PyObject *, PyObject *);
|
||||
static PyInt DictionaryLength(PyObject *);
|
||||
static PyObject *DictionaryItem(PyObject *, PyObject *);
|
||||
|
||||
static PyMappingMethods DictionaryAsMapping = {
|
||||
(lenfunc) DictionaryLength,
|
||||
(binaryfunc) DictionaryItem,
|
||||
(objobjargproc) DictionaryAssItem,
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
DictionaryNew(dict_T *dict)
|
||||
{
|
||||
@@ -658,6 +681,17 @@ DictionaryNew(dict_T *dict)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
DictionaryDestructor(PyObject *self)
|
||||
{
|
||||
DictionaryObject *this = ((DictionaryObject *) (self));
|
||||
|
||||
pyll_remove(&this->ref, &lastdict);
|
||||
dict_unref(this->dict);
|
||||
|
||||
DESTRUCTOR_FINISH(self);
|
||||
}
|
||||
|
||||
static int
|
||||
pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
||||
{
|
||||
@@ -738,6 +772,8 @@ pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
||||
tv->vval.v_dict = d;
|
||||
|
||||
list = PyMapping_Items(obj);
|
||||
if (list == NULL)
|
||||
return -1;
|
||||
lsize = PyList_Size(list);
|
||||
while (lsize--)
|
||||
{
|
||||
@@ -802,9 +838,11 @@ pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyInt
|
||||
DictionarySetattr(DictionaryObject *self, char *name, PyObject *val)
|
||||
static int
|
||||
DictionarySetattr(PyObject *self, char *name, PyObject *val)
|
||||
{
|
||||
DictionaryObject *this = (DictionaryObject *)(self);
|
||||
|
||||
if (val == NULL)
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
|
||||
@@ -813,7 +851,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val)
|
||||
|
||||
if (strcmp(name, "locked") == 0)
|
||||
{
|
||||
if (self->dict->dv_lock == VAR_FIXED)
|
||||
if (this->dict->dv_lock == VAR_FIXED)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary"));
|
||||
return -1;
|
||||
@@ -827,9 +865,9 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val)
|
||||
}
|
||||
|
||||
if (val == Py_True)
|
||||
self->dict->dv_lock = VAR_LOCKED;
|
||||
this->dict->dv_lock = VAR_LOCKED;
|
||||
else
|
||||
self->dict->dv_lock = 0;
|
||||
this->dict->dv_lock = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -861,7 +899,7 @@ DictionaryItem(PyObject *self, PyObject *keyObject)
|
||||
|
||||
if (di == NULL)
|
||||
{
|
||||
PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
|
||||
PyErr_SetString(PyExc_KeyError, _("no such key in dictionary"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -961,6 +999,8 @@ static struct PyMethodDef DictionaryMethods[] = {
|
||||
};
|
||||
|
||||
static PyTypeObject ListType;
|
||||
static PySequenceMethods ListAsSeq;
|
||||
static PyMappingMethods ListAsMapping;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -985,6 +1025,17 @@ ListNew(list_T *list)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
ListDestructor(PyObject *self)
|
||||
{
|
||||
ListObject *this = (ListObject *)(self);
|
||||
|
||||
pyll_remove(&this->ref, &lastlist);
|
||||
list_unref(this->list);
|
||||
|
||||
DESTRUCTOR_FINISH(self);
|
||||
}
|
||||
|
||||
static int
|
||||
list_py_concat(list_T *l, PyObject *obj, PyObject *lookupDict)
|
||||
{
|
||||
@@ -1305,8 +1356,10 @@ ListConcatInPlace(PyObject *self, PyObject *obj)
|
||||
}
|
||||
|
||||
static int
|
||||
ListSetattr(ListObject *self, char *name, PyObject *val)
|
||||
ListSetattr(PyObject *self, char *name, PyObject *val)
|
||||
{
|
||||
ListObject *this = (ListObject *)(self);
|
||||
|
||||
if (val == NULL)
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
|
||||
@@ -1315,7 +1368,7 @@ ListSetattr(ListObject *self, char *name, PyObject *val)
|
||||
|
||||
if (strcmp(name, "locked") == 0)
|
||||
{
|
||||
if (self->list->lv_lock == VAR_FIXED)
|
||||
if (this->list->lv_lock == VAR_FIXED)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed list"));
|
||||
return -1;
|
||||
@@ -1329,9 +1382,9 @@ ListSetattr(ListObject *self, char *name, PyObject *val)
|
||||
}
|
||||
|
||||
if (val == Py_True)
|
||||
self->list->lv_lock = VAR_LOCKED;
|
||||
this->list->lv_lock = VAR_LOCKED;
|
||||
else
|
||||
self->list->lv_lock = 0;
|
||||
this->list->lv_lock = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1374,6 +1427,17 @@ FunctionNew(char_u *name)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
FunctionDestructor(PyObject *self)
|
||||
{
|
||||
FunctionObject *this = (FunctionObject *) (self);
|
||||
|
||||
func_unref(this->name);
|
||||
PyMem_Del(this->name);
|
||||
|
||||
DESTRUCTOR_FINISH(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
FunctionCall(PyObject *self, PyObject *argsObject, PyObject *kwargs)
|
||||
{
|
||||
@@ -1449,6 +1513,45 @@ CheckWindow(WindowObject *this)
|
||||
|
||||
static int WindowSetattr(PyObject *, char *, PyObject *);
|
||||
static PyObject *WindowRepr(PyObject *);
|
||||
static PyTypeObject WindowType;
|
||||
|
||||
static PyObject *
|
||||
WindowAttr(WindowObject *this, char *name)
|
||||
{
|
||||
if (strcmp(name, "buffer") == 0)
|
||||
return (PyObject *)BufferNew(this->win->w_buffer);
|
||||
else if (strcmp(name, "cursor") == 0)
|
||||
{
|
||||
pos_T *pos = &this->win->w_cursor;
|
||||
|
||||
return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
|
||||
}
|
||||
else if (strcmp(name, "height") == 0)
|
||||
return Py_BuildValue("l", (long)(this->win->w_height));
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
else if (strcmp(name, "width") == 0)
|
||||
return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
|
||||
#endif
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[sss]", "buffer", "cursor", "height");
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
WindowDestructor(PyObject *self)
|
||||
{
|
||||
WindowObject *this = (WindowObject *)(self);
|
||||
|
||||
if (this->win && this->win != INVALID_WINDOW_VALUE)
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
this->win->w_python3_ref = NULL;
|
||||
#else
|
||||
this->win->w_python_ref = NULL;
|
||||
#endif
|
||||
|
||||
DESTRUCTOR_FINISH(self);
|
||||
}
|
||||
|
||||
static int
|
||||
WindowSetattr(PyObject *self, char *name, PyObject *val)
|
||||
@@ -1577,6 +1680,15 @@ WindowRepr(PyObject *self)
|
||||
/*
|
||||
* Window list object - Implementation
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} WinListObject;
|
||||
|
||||
static PyTypeObject WinListType;
|
||||
static PySequenceMethods BufListAsSeq;
|
||||
|
||||
static PyInt
|
||||
WinListLength(PyObject *self UNUSED)
|
||||
{
|
||||
@@ -2308,10 +2420,11 @@ RBAppend(BufferObject *self, PyObject *args, PyInt start, PyInt end, PyInt *new_
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
/* Buffer object - Definitions
|
||||
/* Range object - Definitions
|
||||
*/
|
||||
|
||||
static PyTypeObject RangeType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
@@ -2320,6 +2433,10 @@ typedef struct
|
||||
PyInt end;
|
||||
} RangeObject;
|
||||
|
||||
static void RangeDestructor(PyObject *);
|
||||
static PySequenceMethods RangeAsSeq;
|
||||
static PyMappingMethods RangeAsMapping;
|
||||
|
||||
static PyObject *
|
||||
RangeNew(buf_T *buf, PyInt start, PyInt end)
|
||||
{
|
||||
@@ -2344,6 +2461,46 @@ RangeNew(buf_T *buf, PyInt start, PyInt end)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
RangeDestructor(PyObject *self)
|
||||
{
|
||||
Py_DECREF(((RangeObject *)(self))->buf);
|
||||
DESTRUCTOR_FINISH(self);
|
||||
}
|
||||
|
||||
static PyTypeObject BufferType;
|
||||
static PyObject *BufferRepr(PyObject *);
|
||||
static PySequenceMethods BufferAsSeq;
|
||||
static PyMappingMethods BufferAsMapping;
|
||||
|
||||
static void
|
||||
BufferDestructor(PyObject *self)
|
||||
{
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
|
||||
if (this->buf && this->buf != INVALID_BUFFER_VALUE)
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
this->buf->b_python3_ref = NULL;
|
||||
#else
|
||||
this->buf->b_python_ref = NULL;
|
||||
#endif
|
||||
|
||||
DESTRUCTOR_FINISH(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferAttr(BufferObject *this, char *name)
|
||||
{
|
||||
if (strcmp(name, "name") == 0)
|
||||
return Py_BuildValue("s", this->buf->b_ffname);
|
||||
else if (strcmp(name, "number") == 0)
|
||||
return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[ss]", "name", "number");
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferAppend(PyObject *self, PyObject *args)
|
||||
{
|
||||
@@ -2407,6 +2564,35 @@ BufferRange(PyObject *self, PyObject *args)
|
||||
return RangeNew(((BufferObject *)(self))->buf, start, end);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferRepr(PyObject *self)
|
||||
{
|
||||
static char repr[100];
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
|
||||
if (this->buf == INVALID_BUFFER_VALUE)
|
||||
{
|
||||
vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
|
||||
return PyString_FromString(repr);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *name = (char *)this->buf->b_fname;
|
||||
PyInt len;
|
||||
|
||||
if (name == NULL)
|
||||
name = "";
|
||||
len = strlen(name);
|
||||
|
||||
if (len > 35)
|
||||
name = name + (35 - len);
|
||||
|
||||
vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
|
||||
|
||||
return PyString_FromString(repr);
|
||||
}
|
||||
}
|
||||
|
||||
static struct PyMethodDef BufferMethods[] = {
|
||||
/* name, function, calling, documentation */
|
||||
{"append", BufferAppend, 1, "Append data to Vim buffer" },
|
||||
@@ -2495,6 +2681,49 @@ static struct PyMethodDef RangeMethods[] = {
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
/* Current items object - Implementation
|
||||
*/
|
||||
|
||||
static PyInt RangeStart;
|
||||
static PyInt RangeEnd;
|
||||
|
||||
static PyObject *
|
||||
CurrentGetattr(PyObject *self UNUSED, char *name)
|
||||
{
|
||||
if (strcmp(name, "buffer") == 0)
|
||||
return (PyObject *)BufferNew(curbuf);
|
||||
else if (strcmp(name, "window") == 0)
|
||||
return (PyObject *)WindowNew(curwin);
|
||||
else if (strcmp(name, "line") == 0)
|
||||
return GetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum);
|
||||
else if (strcmp(name, "range") == 0)
|
||||
return RangeNew(curbuf, RangeStart, RangeEnd);
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[ssss]", "buffer", "window", "line", "range");
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value)
|
||||
{
|
||||
if (strcmp(name, "line") == 0)
|
||||
{
|
||||
if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, value, NULL) == FAIL)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_ref_in_py(const int copyID)
|
||||
{
|
||||
@@ -2624,7 +2853,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
||||
tv->v_type = VAR_FUNC;
|
||||
func_ref(tv->vval.v_string);
|
||||
}
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
else if (PyBytes_Check(obj))
|
||||
{
|
||||
char_u *result;
|
||||
@@ -2639,30 +2867,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
||||
|
||||
tv->v_type = VAR_STRING;
|
||||
}
|
||||
else if (PyUnicode_Check(obj))
|
||||
{
|
||||
PyObject *bytes;
|
||||
char_u *result;
|
||||
|
||||
bytes = PyString_AsBytes(obj);
|
||||
if (bytes == NULL)
|
||||
return -1;
|
||||
|
||||
if(PyString_AsStringAndSize(bytes, (char **) &result, NULL) == -1)
|
||||
return -1;
|
||||
if (result == NULL)
|
||||
return -1;
|
||||
|
||||
if (set_string_copy(result, tv) == -1)
|
||||
{
|
||||
Py_XDECREF(bytes);
|
||||
return -1;
|
||||
}
|
||||
Py_XDECREF(bytes);
|
||||
|
||||
tv->v_type = VAR_STRING;
|
||||
}
|
||||
#else
|
||||
else if (PyUnicode_Check(obj))
|
||||
{
|
||||
PyObject *bytes;
|
||||
@@ -2686,20 +2890,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
||||
|
||||
tv->v_type = VAR_STRING;
|
||||
}
|
||||
else if (PyString_Check(obj))
|
||||
{
|
||||
char_u *result;
|
||||
|
||||
if(PyString_AsStringAndSize(obj, (char **) &result, NULL) == -1)
|
||||
return -1;
|
||||
if (result == NULL)
|
||||
return -1;
|
||||
|
||||
if (set_string_copy(result, tv) == -1)
|
||||
return -1;
|
||||
|
||||
tv->v_type = VAR_STRING;
|
||||
}
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
else if (PyInt_Check(obj))
|
||||
{
|
||||
tv->v_type = VAR_NUMBER;
|
||||
@@ -2768,3 +2959,169 @@ ConvertToPyObject(typval_T *tv)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} CurrentObject;
|
||||
static PyTypeObject CurrentType;
|
||||
|
||||
static void
|
||||
init_structs(void)
|
||||
{
|
||||
vim_memset(&OutputType, 0, sizeof(OutputType));
|
||||
OutputType.tp_name = "vim.message";
|
||||
OutputType.tp_basicsize = sizeof(OutputObject);
|
||||
OutputType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
OutputType.tp_doc = "vim message object";
|
||||
OutputType.tp_methods = OutputMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
OutputType.tp_getattro = OutputGetattro;
|
||||
OutputType.tp_setattro = OutputSetattro;
|
||||
OutputType.tp_alloc = call_PyType_GenericAlloc;
|
||||
OutputType.tp_new = call_PyType_GenericNew;
|
||||
OutputType.tp_free = call_PyObject_Free;
|
||||
#else
|
||||
OutputType.tp_getattr = OutputGetattr;
|
||||
OutputType.tp_setattr = OutputSetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&BufferType, 0, sizeof(BufferType));
|
||||
BufferType.tp_name = "vim.buffer";
|
||||
BufferType.tp_basicsize = sizeof(BufferType);
|
||||
BufferType.tp_dealloc = BufferDestructor;
|
||||
BufferType.tp_repr = BufferRepr;
|
||||
BufferType.tp_as_sequence = &BufferAsSeq;
|
||||
BufferType.tp_as_mapping = &BufferAsMapping;
|
||||
BufferType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
BufferType.tp_doc = "vim buffer object";
|
||||
BufferType.tp_methods = BufferMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
BufferType.tp_getattro = BufferGetattro;
|
||||
BufferType.tp_alloc = call_PyType_GenericAlloc;
|
||||
BufferType.tp_new = call_PyType_GenericNew;
|
||||
BufferType.tp_free = call_PyObject_Free;
|
||||
#else
|
||||
BufferType.tp_getattr = BufferGetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&WindowType, 0, sizeof(WindowType));
|
||||
WindowType.tp_name = "vim.window";
|
||||
WindowType.tp_basicsize = sizeof(WindowObject);
|
||||
WindowType.tp_dealloc = WindowDestructor;
|
||||
WindowType.tp_repr = WindowRepr;
|
||||
WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
WindowType.tp_doc = "vim Window object";
|
||||
WindowType.tp_methods = WindowMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
WindowType.tp_getattro = WindowGetattro;
|
||||
WindowType.tp_setattro = WindowSetattro;
|
||||
WindowType.tp_alloc = call_PyType_GenericAlloc;
|
||||
WindowType.tp_new = call_PyType_GenericNew;
|
||||
WindowType.tp_free = call_PyObject_Free;
|
||||
#else
|
||||
WindowType.tp_getattr = WindowGetattr;
|
||||
WindowType.tp_setattr = WindowSetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&BufListType, 0, sizeof(BufListType));
|
||||
BufListType.tp_name = "vim.bufferlist";
|
||||
BufListType.tp_basicsize = sizeof(BufListObject);
|
||||
BufListType.tp_as_sequence = &BufListAsSeq;
|
||||
BufListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
BufferType.tp_doc = "vim buffer list";
|
||||
|
||||
vim_memset(&WinListType, 0, sizeof(WinListType));
|
||||
WinListType.tp_name = "vim.windowlist";
|
||||
WinListType.tp_basicsize = sizeof(WinListType);
|
||||
WinListType.tp_as_sequence = &WinListAsSeq;
|
||||
WinListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
WinListType.tp_doc = "vim window list";
|
||||
|
||||
vim_memset(&RangeType, 0, sizeof(RangeType));
|
||||
RangeType.tp_name = "vim.range";
|
||||
RangeType.tp_basicsize = sizeof(RangeObject);
|
||||
RangeType.tp_dealloc = RangeDestructor;
|
||||
RangeType.tp_repr = RangeRepr;
|
||||
RangeType.tp_as_sequence = &RangeAsSeq;
|
||||
RangeType.tp_as_mapping = &RangeAsMapping;
|
||||
RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
RangeType.tp_doc = "vim Range object";
|
||||
RangeType.tp_methods = RangeMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
RangeType.tp_getattro = RangeGetattro;
|
||||
RangeType.tp_alloc = call_PyType_GenericAlloc;
|
||||
RangeType.tp_new = call_PyType_GenericNew;
|
||||
RangeType.tp_free = call_PyObject_Free;
|
||||
#else
|
||||
RangeType.tp_getattr = RangeGetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&CurrentType, 0, sizeof(CurrentType));
|
||||
CurrentType.tp_name = "vim.currentdata";
|
||||
CurrentType.tp_basicsize = sizeof(CurrentObject);
|
||||
CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
CurrentType.tp_doc = "vim current object";
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
CurrentType.tp_getattro = CurrentGetattro;
|
||||
CurrentType.tp_setattro = CurrentSetattro;
|
||||
#else
|
||||
CurrentType.tp_getattr = CurrentGetattr;
|
||||
CurrentType.tp_setattr = CurrentSetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
|
||||
DictionaryType.tp_name = "vim.dictionary";
|
||||
DictionaryType.tp_basicsize = sizeof(DictionaryObject);
|
||||
DictionaryType.tp_dealloc = DictionaryDestructor;
|
||||
DictionaryType.tp_as_mapping = &DictionaryAsMapping;
|
||||
DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
|
||||
DictionaryType.tp_methods = DictionaryMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
DictionaryType.tp_getattro = DictionaryGetattro;
|
||||
DictionaryType.tp_setattro = DictionarySetattro;
|
||||
#else
|
||||
DictionaryType.tp_getattr = DictionaryGetattr;
|
||||
DictionaryType.tp_setattr = DictionarySetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&ListType, 0, sizeof(ListType));
|
||||
ListType.tp_name = "vim.list";
|
||||
ListType.tp_dealloc = ListDestructor;
|
||||
ListType.tp_basicsize = sizeof(ListObject);
|
||||
ListType.tp_as_sequence = &ListAsSeq;
|
||||
ListType.tp_as_mapping = &ListAsMapping;
|
||||
ListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
ListType.tp_doc = "list pushing modifications to vim structure";
|
||||
ListType.tp_methods = ListMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
ListType.tp_getattro = ListGetattro;
|
||||
ListType.tp_setattro = ListSetattro;
|
||||
#else
|
||||
ListType.tp_getattr = ListGetattr;
|
||||
ListType.tp_setattr = ListSetattr;
|
||||
#endif
|
||||
|
||||
vim_memset(&FunctionType, 0, sizeof(FunctionType));
|
||||
FunctionType.tp_name = "vim.list";
|
||||
FunctionType.tp_basicsize = sizeof(FunctionObject);
|
||||
FunctionType.tp_dealloc = FunctionDestructor;
|
||||
FunctionType.tp_call = FunctionCall;
|
||||
FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
FunctionType.tp_doc = "object that calls vim function";
|
||||
FunctionType.tp_methods = FunctionMethods;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
FunctionType.tp_getattro = FunctionGetattro;
|
||||
#else
|
||||
FunctionType.tp_getattr = FunctionGetattr;
|
||||
#endif
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
vim_memset(&vimmodule, 0, sizeof(vimmodule));
|
||||
vimmodule.m_name = "vim";
|
||||
vimmodule.m_doc = "Vim Python interface\n";
|
||||
vimmodule.m_size = -1;
|
||||
vimmodule.m_methods = VimMethods;
|
||||
#endif
|
||||
}
|
||||
|
||||
477
src/if_python.c
477
src/if_python.c
@@ -59,6 +59,7 @@
|
||||
static void init_structs(void);
|
||||
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyBytes_Check PyString_Check
|
||||
|
||||
/* No-op conversion functions, use with care! */
|
||||
#define PyString_AsBytes(obj) (obj)
|
||||
@@ -87,6 +88,7 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# define Py_ssize_t_fmt "n"
|
||||
#else
|
||||
# define PyInt int
|
||||
# define lenfunc inquiry
|
||||
# define PyInquiry inquiry
|
||||
# define PyIntArgFunc intargfunc
|
||||
# define PyIntIntArgFunc intintargfunc
|
||||
@@ -348,12 +350,14 @@ static HINSTANCE hinstPython = 0; /* Instance of python.dll */
|
||||
/* Imported exception objects */
|
||||
static PyObject *imp_PyExc_AttributeError;
|
||||
static PyObject *imp_PyExc_IndexError;
|
||||
static PyObject *imp_PyExc_KeyError;
|
||||
static PyObject *imp_PyExc_KeyboardInterrupt;
|
||||
static PyObject *imp_PyExc_TypeError;
|
||||
static PyObject *imp_PyExc_ValueError;
|
||||
|
||||
# define PyExc_AttributeError imp_PyExc_AttributeError
|
||||
# define PyExc_IndexError imp_PyExc_IndexError
|
||||
# define PyExc_KeyError imp_PyExc_KeyError
|
||||
# define PyExc_KeyboardInterrupt imp_PyExc_KeyboardInterrupt
|
||||
# define PyExc_TypeError imp_PyExc_TypeError
|
||||
# define PyExc_ValueError imp_PyExc_ValueError
|
||||
@@ -579,11 +583,13 @@ get_exceptions(void)
|
||||
PyObject *exdict = PyModule_GetDict(exmod);
|
||||
imp_PyExc_AttributeError = PyDict_GetItemString(exdict, "AttributeError");
|
||||
imp_PyExc_IndexError = PyDict_GetItemString(exdict, "IndexError");
|
||||
imp_PyExc_KeyError = PyDict_GetItemString(exdict, "KeyError");
|
||||
imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt");
|
||||
imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
|
||||
imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
|
||||
Py_XINCREF(imp_PyExc_AttributeError);
|
||||
Py_XINCREF(imp_PyExc_IndexError);
|
||||
Py_XINCREF(imp_PyExc_KeyError);
|
||||
Py_XINCREF(imp_PyExc_KeyboardInterrupt);
|
||||
Py_XINCREF(imp_PyExc_TypeError);
|
||||
Py_XINCREF(imp_PyExc_ValueError);
|
||||
@@ -596,8 +602,6 @@ static PyObject *WindowNew(win_T *);
|
||||
static PyObject *DictionaryNew(dict_T *);
|
||||
static PyObject *LineToString(const char *);
|
||||
|
||||
static PyTypeObject RangeType;
|
||||
|
||||
static int initialised = 0;
|
||||
#define PYINITIALISED initialised
|
||||
|
||||
@@ -613,6 +617,16 @@ static int initialised = 0;
|
||||
#define DICTKEY_UNREF
|
||||
#define DICTKEY_DECL
|
||||
|
||||
#define DESTRUCTOR_FINISH(self) Py_DECREF(self);
|
||||
|
||||
static PyObject *OutputGetattr(PyObject *, char *);
|
||||
static PyObject *BufferGetattr(PyObject *, char *);
|
||||
static PyObject *WindowGetattr(PyObject *, char *);
|
||||
static PyObject *RangeGetattr(PyObject *, char *);
|
||||
static PyObject *DictionaryGetattr(PyObject *, char*);
|
||||
static PyObject *ListGetattr(PyObject *, char *);
|
||||
static PyObject *FunctionGetattr(PyObject *, char *);
|
||||
|
||||
/*
|
||||
* Include the code shared with if_python3.c
|
||||
*/
|
||||
@@ -623,9 +637,6 @@ static int initialised = 0;
|
||||
* Internal function prototypes.
|
||||
*/
|
||||
|
||||
static PyInt RangeStart;
|
||||
static PyInt RangeEnd;
|
||||
|
||||
static PyObject *globals;
|
||||
|
||||
static void PythonIO_Flush(void);
|
||||
@@ -999,19 +1010,12 @@ static int ConvertFromPyObject(PyObject *, typval_T *);
|
||||
|
||||
#define WindowType_Check(obj) ((obj)->ob_type == &WindowType)
|
||||
|
||||
static void WindowDestructor(PyObject *);
|
||||
static PyObject *WindowGetattr(PyObject *, char *);
|
||||
|
||||
/* Buffer type - Implementation functions
|
||||
* --------------------------------------
|
||||
*/
|
||||
|
||||
#define BufferType_Check(obj) ((obj)->ob_type == &BufferType)
|
||||
|
||||
static void BufferDestructor(PyObject *);
|
||||
static PyObject *BufferGetattr(PyObject *, char *);
|
||||
static PyObject *BufferRepr(PyObject *);
|
||||
|
||||
static PyInt BufferLength(PyObject *);
|
||||
static PyObject *BufferItem(PyObject *, PyInt);
|
||||
static PyObject *BufferSlice(PyObject *, PyInt, PyInt);
|
||||
@@ -1031,9 +1035,6 @@ static PyInt RangeAssSlice(PyObject *, PyInt, PyInt, PyObject *);
|
||||
* -----------------------------------------------
|
||||
*/
|
||||
|
||||
static PyObject *CurrentGetattr(PyObject *, char *);
|
||||
static int CurrentSetattr(PyObject *, char *, PyObject *);
|
||||
|
||||
static PySequenceMethods BufferAsSeq = {
|
||||
(PyInquiry) BufferLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* BufferConcat, sq_concat, x+y */
|
||||
@@ -1041,30 +1042,12 @@ static PySequenceMethods BufferAsSeq = {
|
||||
(PyIntArgFunc) BufferItem, /* sq_item, x[i] */
|
||||
(PyIntIntArgFunc) BufferSlice, /* sq_slice, x[i:j] */
|
||||
(PyIntObjArgProc) BufferAssItem, /* sq_ass_item, x[i]=v */
|
||||
(PyIntIntObjArgProc) BufferAssSlice, /* sq_ass_slice, x[i:j]=v */
|
||||
};
|
||||
|
||||
static PyTypeObject BufferType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
(PyIntIntObjArgProc) BufferAssSlice, /* sq_ass_slice, x[i:j]=v */
|
||||
(objobjproc) 0,
|
||||
#if PY_MAJOR_VERSION >= 2
|
||||
(binaryfunc) 0,
|
||||
0,
|
||||
"buffer",
|
||||
sizeof(BufferObject),
|
||||
0,
|
||||
|
||||
(destructor) BufferDestructor, /* tp_dealloc, refcount==0 */
|
||||
(printfunc) 0, /* tp_print, print x */
|
||||
(getattrfunc) BufferGetattr, /* tp_getattr, x.attr */
|
||||
(setattrfunc) 0, /* tp_setattr, x.attr=v */
|
||||
(cmpfunc) 0, /* tp_compare, x>y */
|
||||
(reprfunc) BufferRepr, /* tp_repr, `x`, print x */
|
||||
|
||||
0, /* as number */
|
||||
&BufferAsSeq, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0, /* tp_hash, dict(x) */
|
||||
(ternaryfunc) 0, /* tp_call, x() */
|
||||
(reprfunc) 0, /* tp_str, str(x) */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Buffer object - Implementation
|
||||
@@ -1106,64 +1089,21 @@ BufferNew(buf_T *buf)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
BufferDestructor(PyObject *self)
|
||||
{
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
|
||||
if (this->buf && this->buf != INVALID_BUFFER_VALUE)
|
||||
this->buf->b_python_ref = NULL;
|
||||
|
||||
Py_DECREF(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferGetattr(PyObject *self, char *name)
|
||||
{
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
PyObject *r;
|
||||
|
||||
if (CheckBuffer(this))
|
||||
if (CheckBuffer((BufferObject *)(self)))
|
||||
return NULL;
|
||||
|
||||
if (strcmp(name, "name") == 0)
|
||||
return Py_BuildValue("s", this->buf->b_ffname);
|
||||
else if (strcmp(name, "number") == 0)
|
||||
return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[ss]", "name", "number");
|
||||
r = BufferAttr((BufferObject *)(self), name);
|
||||
if (r || PyErr_Occurred())
|
||||
return r;
|
||||
else
|
||||
return Py_FindMethod(BufferMethods, self, name);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferRepr(PyObject *self)
|
||||
{
|
||||
static char repr[100];
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
|
||||
if (this->buf == INVALID_BUFFER_VALUE)
|
||||
{
|
||||
vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
|
||||
return PyString_FromString(repr);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *name = (char *)this->buf->b_fname;
|
||||
PyInt len;
|
||||
|
||||
if (name == NULL)
|
||||
name = "";
|
||||
len = strlen(name);
|
||||
|
||||
if (len > 35)
|
||||
name = name + (35 - len);
|
||||
|
||||
vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
|
||||
|
||||
return PyString_FromString(repr);
|
||||
}
|
||||
}
|
||||
|
||||
/******************/
|
||||
|
||||
static PyInt
|
||||
@@ -1207,25 +1147,23 @@ BufferAssSlice(PyObject *self, PyInt lo, PyInt hi, PyObject *val)
|
||||
}
|
||||
|
||||
static PySequenceMethods RangeAsSeq = {
|
||||
(PyInquiry) RangeLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* RangeConcat, */ /* sq_concat, x+y */
|
||||
(PyIntArgFunc) 0, /* RangeRepeat, */ /* sq_repeat, x*n */
|
||||
(PyIntArgFunc) RangeItem, /* sq_item, x[i] */
|
||||
(PyIntIntArgFunc) RangeSlice, /* sq_slice, x[i:j] */
|
||||
(PyIntObjArgProc) RangeAssItem, /* sq_ass_item, x[i]=v */
|
||||
(PyIntIntObjArgProc) RangeAssSlice, /* sq_ass_slice, x[i:j]=v */
|
||||
(PyInquiry) RangeLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* RangeConcat, */ /* sq_concat, x+y */
|
||||
(PyIntArgFunc) 0, /* RangeRepeat, */ /* sq_repeat, x*n */
|
||||
(PyIntArgFunc) RangeItem, /* sq_item, x[i] */
|
||||
(PyIntIntArgFunc) RangeSlice, /* sq_slice, x[i:j] */
|
||||
(PyIntObjArgProc) RangeAssItem, /* sq_ass_item, x[i]=v */
|
||||
(PyIntIntObjArgProc) RangeAssSlice, /* sq_ass_slice, x[i:j]=v */
|
||||
(objobjproc) 0,
|
||||
#if PY_MAJOR_VERSION >= 2
|
||||
(binaryfunc) 0,
|
||||
0,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Line range object - Implementation
|
||||
*/
|
||||
|
||||
static void
|
||||
RangeDestructor(PyObject *self)
|
||||
{
|
||||
Py_DECREF(((RangeObject *)(self))->buf);
|
||||
Py_DECREF(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
RangeGetattr(PyObject *self, char *name)
|
||||
{
|
||||
@@ -1260,11 +1198,6 @@ RangeAssSlice(PyObject *self, PyInt lo, PyInt hi, PyObject *val)
|
||||
/* Buffer list object - Definitions
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} BufListObject;
|
||||
|
||||
static PySequenceMethods BufListAsSeq = {
|
||||
(PyInquiry) BufListLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* sq_concat, x+y */
|
||||
@@ -1272,61 +1205,12 @@ static PySequenceMethods BufListAsSeq = {
|
||||
(PyIntArgFunc) BufListItem, /* sq_item, x[i] */
|
||||
(PyIntIntArgFunc) 0, /* sq_slice, x[i:j] */
|
||||
(PyIntObjArgProc) 0, /* sq_ass_item, x[i]=v */
|
||||
(PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
||||
};
|
||||
|
||||
static PyTypeObject BufListType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
(PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
||||
(objobjproc) 0,
|
||||
#if PY_MAJOR_VERSION >= 2
|
||||
(binaryfunc) 0,
|
||||
0,
|
||||
"buffer list",
|
||||
sizeof(BufListObject),
|
||||
0,
|
||||
|
||||
(destructor) 0, /* tp_dealloc, refcount==0 */
|
||||
(printfunc) 0, /* tp_print, print x */
|
||||
(getattrfunc) 0, /* tp_getattr, x.attr */
|
||||
(setattrfunc) 0, /* tp_setattr, x.attr=v */
|
||||
(cmpfunc) 0, /* tp_compare, x>y */
|
||||
(reprfunc) 0, /* tp_repr, `x`, print x */
|
||||
|
||||
0, /* as number */
|
||||
&BufListAsSeq, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0, /* tp_hash, dict(x) */
|
||||
(ternaryfunc) 0, /* tp_call, x() */
|
||||
(reprfunc) 0, /* tp_str, str(x) */
|
||||
};
|
||||
|
||||
/* Window object - Definitions
|
||||
*/
|
||||
|
||||
static struct PyMethodDef WindowMethods[] = {
|
||||
/* name, function, calling, documentation */
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
static PyTypeObject WindowType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"window",
|
||||
sizeof(WindowObject),
|
||||
0,
|
||||
|
||||
(destructor) WindowDestructor, /* tp_dealloc, refcount==0 */
|
||||
(printfunc) 0, /* tp_print, print x */
|
||||
(getattrfunc) WindowGetattr, /* tp_getattr, x.attr */
|
||||
(setattrfunc) WindowSetattr, /* tp_setattr, x.attr=v */
|
||||
(cmpfunc) 0, /* tp_compare, x>y */
|
||||
(reprfunc) WindowRepr, /* tp_repr, `x`, print x */
|
||||
|
||||
0, /* as number */
|
||||
0, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0, /* tp_hash, dict(x) */
|
||||
(ternaryfunc) 0, /* tp_call, x() */
|
||||
(reprfunc) 0, /* tp_str, str(x) */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Window object - Implementation
|
||||
@@ -1366,41 +1250,17 @@ WindowNew(win_T *win)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
WindowDestructor(PyObject *self)
|
||||
{
|
||||
WindowObject *this = (WindowObject *)(self);
|
||||
|
||||
if (this->win && this->win != INVALID_WINDOW_VALUE)
|
||||
this->win->w_python_ref = NULL;
|
||||
|
||||
Py_DECREF(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
WindowGetattr(PyObject *self, char *name)
|
||||
{
|
||||
WindowObject *this = (WindowObject *)(self);
|
||||
PyObject *r;
|
||||
|
||||
if (CheckWindow(this))
|
||||
if (CheckWindow((WindowObject *)(self)))
|
||||
return NULL;
|
||||
|
||||
if (strcmp(name, "buffer") == 0)
|
||||
return (PyObject *)BufferNew(this->win->w_buffer);
|
||||
else if (strcmp(name, "cursor") == 0)
|
||||
{
|
||||
pos_T *pos = &this->win->w_cursor;
|
||||
|
||||
return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
|
||||
}
|
||||
else if (strcmp(name, "height") == 0)
|
||||
return Py_BuildValue("l", (long)(this->win->w_height));
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
else if (strcmp(name, "width") == 0)
|
||||
return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
|
||||
#endif
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[sss]", "buffer", "cursor", "height");
|
||||
r = WindowAttr((WindowObject *)(self), name);
|
||||
if (r || PyErr_Occurred())
|
||||
return r;
|
||||
else
|
||||
return Py_FindMethod(WindowMethods, self, name);
|
||||
}
|
||||
@@ -1408,12 +1268,6 @@ WindowGetattr(PyObject *self, char *name)
|
||||
/* Window list object - Definitions
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
}
|
||||
WinListObject;
|
||||
|
||||
static PySequenceMethods WinListAsSeq = {
|
||||
(PyInquiry) WinListLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* sq_concat, x+y */
|
||||
@@ -1421,102 +1275,14 @@ static PySequenceMethods WinListAsSeq = {
|
||||
(PyIntArgFunc) WinListItem, /* sq_item, x[i] */
|
||||
(PyIntIntArgFunc) 0, /* sq_slice, x[i:j] */
|
||||
(PyIntObjArgProc) 0, /* sq_ass_item, x[i]=v */
|
||||
(PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
||||
(PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
||||
(objobjproc) 0,
|
||||
#if PY_MAJOR_VERSION >= 2
|
||||
(binaryfunc) 0,
|
||||
0,
|
||||
#endif
|
||||
};
|
||||
|
||||
static PyTypeObject WinListType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"window list",
|
||||
sizeof(WinListObject),
|
||||
0,
|
||||
|
||||
(destructor) 0, /* tp_dealloc, refcount==0 */
|
||||
(printfunc) 0, /* tp_print, print x */
|
||||
(getattrfunc) 0, /* tp_getattr, x.attr */
|
||||
(setattrfunc) 0, /* tp_setattr, x.attr=v */
|
||||
(cmpfunc) 0, /* tp_compare, x>y */
|
||||
(reprfunc) 0, /* tp_repr, `x`, print x */
|
||||
|
||||
0, /* as number */
|
||||
&WinListAsSeq, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0, /* tp_hash, dict(x) */
|
||||
(ternaryfunc) 0, /* tp_call, x() */
|
||||
(reprfunc) 0, /* tp_str, str(x) */
|
||||
};
|
||||
|
||||
/* Current items object - Definitions
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} CurrentObject;
|
||||
|
||||
static PyTypeObject CurrentType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"current data",
|
||||
sizeof(CurrentObject),
|
||||
0,
|
||||
|
||||
(destructor) 0, /* tp_dealloc, refcount==0 */
|
||||
(printfunc) 0, /* tp_print, print x */
|
||||
(getattrfunc) CurrentGetattr, /* tp_getattr, x.attr */
|
||||
(setattrfunc) CurrentSetattr, /* tp_setattr, x.attr=v */
|
||||
(cmpfunc) 0, /* tp_compare, x>y */
|
||||
(reprfunc) 0, /* tp_repr, `x`, print x */
|
||||
|
||||
0, /* as number */
|
||||
0, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0, /* tp_hash, dict(x) */
|
||||
(ternaryfunc) 0, /* tp_call, x() */
|
||||
(reprfunc) 0, /* tp_str, str(x) */
|
||||
};
|
||||
|
||||
/* Current items object - Implementation
|
||||
*/
|
||||
static PyObject *
|
||||
CurrentGetattr(PyObject *self UNUSED, char *name)
|
||||
{
|
||||
if (strcmp(name, "buffer") == 0)
|
||||
return (PyObject *)BufferNew(curbuf);
|
||||
else if (strcmp(name, "window") == 0)
|
||||
return (PyObject *)WindowNew(curwin);
|
||||
else if (strcmp(name, "line") == 0)
|
||||
return GetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum);
|
||||
else if (strcmp(name, "range") == 0)
|
||||
return RangeNew(curbuf, RangeStart, RangeEnd);
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[ssss]", "buffer", "window", "line", "range");
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value)
|
||||
{
|
||||
if (strcmp(name, "line") == 0)
|
||||
{
|
||||
if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, value, NULL) == FAIL)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* External interface
|
||||
*/
|
||||
|
||||
@@ -1638,49 +1404,6 @@ LineToString(const char *str)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void DictionaryDestructor(PyObject *);
|
||||
static PyObject *DictionaryGetattr(PyObject *, char*);
|
||||
|
||||
static PyMappingMethods DictionaryAsMapping = {
|
||||
(PyInquiry) DictionaryLength,
|
||||
(binaryfunc) DictionaryItem,
|
||||
(objobjargproc) DictionaryAssItem,
|
||||
};
|
||||
|
||||
static PyTypeObject DictionaryType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"vimdictionary",
|
||||
sizeof(DictionaryObject),
|
||||
0,
|
||||
|
||||
(destructor) DictionaryDestructor,
|
||||
(printfunc) 0,
|
||||
(getattrfunc) DictionaryGetattr,
|
||||
(setattrfunc) DictionarySetattr,
|
||||
(cmpfunc) 0,
|
||||
(reprfunc) 0,
|
||||
|
||||
0, /* as number */
|
||||
0, /* as sequence */
|
||||
&DictionaryAsMapping, /* as mapping */
|
||||
|
||||
(hashfunc) 0,
|
||||
(ternaryfunc) 0,
|
||||
(reprfunc) 0,
|
||||
};
|
||||
|
||||
static void
|
||||
DictionaryDestructor(PyObject *self)
|
||||
{
|
||||
DictionaryObject *this = ((DictionaryObject *) (self));
|
||||
|
||||
pyll_remove(&this->ref, &lastdict);
|
||||
dict_unref(this->dict);
|
||||
|
||||
Py_DECREF(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
DictionaryGetattr(PyObject *self, char *name)
|
||||
{
|
||||
@@ -1694,9 +1417,6 @@ DictionaryGetattr(PyObject *self, char *name)
|
||||
return Py_FindMethod(DictionaryMethods, self, name);
|
||||
}
|
||||
|
||||
static void ListDestructor(PyObject *);
|
||||
static PyObject *ListGetattr(PyObject *, char *);
|
||||
|
||||
static PySequenceMethods ListAsSeq = {
|
||||
(PyInquiry) ListLength,
|
||||
(binaryfunc) 0,
|
||||
@@ -1712,40 +1432,6 @@ static PySequenceMethods ListAsSeq = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static PyTypeObject ListType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"vimlist",
|
||||
sizeof(ListObject),
|
||||
0,
|
||||
|
||||
(destructor) ListDestructor,
|
||||
(printfunc) 0,
|
||||
(getattrfunc) ListGetattr,
|
||||
(setattrfunc) ListSetattr,
|
||||
(cmpfunc) 0,
|
||||
(reprfunc) 0,
|
||||
|
||||
0, /* as number */
|
||||
&ListAsSeq, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0,
|
||||
(ternaryfunc) 0,
|
||||
(reprfunc) 0,
|
||||
};
|
||||
|
||||
static void
|
||||
ListDestructor(PyObject *self)
|
||||
{
|
||||
ListObject *this = ((ListObject *) (self));
|
||||
|
||||
pyll_remove(&this->ref, &lastlist);
|
||||
list_unref(this->list);
|
||||
|
||||
Py_DECREF(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
ListGetattr(PyObject *self, char *name)
|
||||
{
|
||||
@@ -1755,43 +1441,6 @@ ListGetattr(PyObject *self, char *name)
|
||||
return Py_FindMethod(ListMethods, self, name);
|
||||
}
|
||||
|
||||
static void FunctionDestructor(PyObject *);
|
||||
static PyObject *FunctionGetattr(PyObject *, char *);
|
||||
|
||||
static PyTypeObject FunctionType = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"vimfunction",
|
||||
sizeof(FunctionObject),
|
||||
0,
|
||||
|
||||
(destructor) FunctionDestructor,
|
||||
(printfunc) 0,
|
||||
(getattrfunc) FunctionGetattr,
|
||||
(setattrfunc) 0,
|
||||
(cmpfunc) 0,
|
||||
(reprfunc) 0,
|
||||
|
||||
0, /* as number */
|
||||
0, /* as sequence */
|
||||
0, /* as mapping */
|
||||
|
||||
(hashfunc) 0,
|
||||
(ternaryfunc) FunctionCall,
|
||||
(reprfunc) 0,
|
||||
};
|
||||
|
||||
static void
|
||||
FunctionDestructor(PyObject *self)
|
||||
{
|
||||
FunctionObject *this = (FunctionObject *) (self);
|
||||
|
||||
func_unref(this->name);
|
||||
PyMem_Del(this->name);
|
||||
|
||||
Py_DECREF(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
FunctionGetattr(PyObject *self, char *name)
|
||||
{
|
||||
@@ -1835,21 +1484,3 @@ set_ref_in_python (int copyID)
|
||||
{
|
||||
set_ref_in_py(copyID);
|
||||
}
|
||||
|
||||
static void
|
||||
init_structs(void)
|
||||
{
|
||||
vim_memset(&OutputType, 0, sizeof(OutputType));
|
||||
OutputType.tp_name = "message";
|
||||
OutputType.tp_basicsize = sizeof(OutputObject);
|
||||
OutputType.tp_getattr = OutputGetattr;
|
||||
OutputType.tp_setattr = OutputSetattr;
|
||||
|
||||
vim_memset(&RangeType, 0, sizeof(RangeType));
|
||||
RangeType.tp_name = "range";
|
||||
RangeType.tp_basicsize = sizeof(RangeObject);
|
||||
RangeType.tp_dealloc = RangeDestructor;
|
||||
RangeType.tp_getattr = RangeGetattr;
|
||||
RangeType.tp_repr = RangeRepr;
|
||||
RangeType.tp_as_sequence = &RangeAsSeq;
|
||||
}
|
||||
|
||||
395
src/if_python3.c
395
src/if_python3.c
@@ -91,6 +91,7 @@ static void init_structs(void);
|
||||
#define PyInt_Check(obj) PyLong_Check(obj)
|
||||
#define PyInt_FromLong(i) PyLong_FromLong(i)
|
||||
#define PyInt_AsLong(obj) PyLong_AsLong(obj)
|
||||
#define Py_ssize_t_fmt "n"
|
||||
|
||||
#if defined(DYNAMIC_PYTHON3) || defined(PROTO)
|
||||
|
||||
@@ -327,12 +328,14 @@ static HINSTANCE hinstPy3 = 0; /* Instance of python.dll */
|
||||
/* Imported exception objects */
|
||||
static PyObject *p3imp_PyExc_AttributeError;
|
||||
static PyObject *p3imp_PyExc_IndexError;
|
||||
static PyObject *p3imp_PyExc_KeyError;
|
||||
static PyObject *p3imp_PyExc_KeyboardInterrupt;
|
||||
static PyObject *p3imp_PyExc_TypeError;
|
||||
static PyObject *p3imp_PyExc_ValueError;
|
||||
|
||||
# define PyExc_AttributeError p3imp_PyExc_AttributeError
|
||||
# define PyExc_IndexError p3imp_PyExc_IndexError
|
||||
# define PyExc_KeyError p3imp_PyExc_KeyError
|
||||
# define PyExc_KeyboardInterrupt p3imp_PyExc_KeyboardInterrupt
|
||||
# define PyExc_TypeError p3imp_PyExc_TypeError
|
||||
# define PyExc_ValueError p3imp_PyExc_ValueError
|
||||
@@ -567,11 +570,13 @@ get_py3_exceptions()
|
||||
PyObject *exdict = PyModule_GetDict(exmod);
|
||||
p3imp_PyExc_AttributeError = PyDict_GetItemString(exdict, "AttributeError");
|
||||
p3imp_PyExc_IndexError = PyDict_GetItemString(exdict, "IndexError");
|
||||
p3imp_PyExc_KeyError = PyDict_GetItemString(exdict, "KeyError");
|
||||
p3imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt");
|
||||
p3imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
|
||||
p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
|
||||
Py_XINCREF(p3imp_PyExc_AttributeError);
|
||||
Py_XINCREF(p3imp_PyExc_IndexError);
|
||||
Py_XINCREF(p3imp_PyExc_KeyError);
|
||||
Py_XINCREF(p3imp_PyExc_KeyboardInterrupt);
|
||||
Py_XINCREF(p3imp_PyExc_TypeError);
|
||||
Py_XINCREF(p3imp_PyExc_ValueError);
|
||||
@@ -584,8 +589,6 @@ static PyObject *WindowNew(win_T *);
|
||||
static PyObject *LineToString(const char *);
|
||||
static PyObject *BufferDir(PyObject *, PyObject *);
|
||||
|
||||
static PyTypeObject RangeType;
|
||||
|
||||
static int py3initialised = 0;
|
||||
|
||||
#define PYINITIALISED py3initialised
|
||||
@@ -616,17 +619,7 @@ static int py3initialised = 0;
|
||||
if (bytes != NULL) \
|
||||
Py_XDECREF(bytes);
|
||||
|
||||
/*
|
||||
* Include the code shared with if_python.c
|
||||
*/
|
||||
#include "if_py_both.h"
|
||||
|
||||
#define GET_ATTR_STRING(name, nameobj) \
|
||||
char *name = ""; \
|
||||
if (PyUnicode_Check(nameobj)) \
|
||||
name = _PyUnicode_AsString(nameobj)
|
||||
|
||||
#define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
|
||||
#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
|
||||
static void
|
||||
call_PyObject_Free(void *p)
|
||||
@@ -650,13 +643,38 @@ call_PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
|
||||
return PyType_GenericAlloc(type,nitems);
|
||||
}
|
||||
|
||||
static PyObject *OutputGetattro(PyObject *, PyObject *);
|
||||
static int OutputSetattro(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject *BufferGetattro(PyObject *, PyObject *);
|
||||
static PyObject *WindowGetattro(PyObject *, PyObject *);
|
||||
static int WindowSetattro(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject *RangeGetattro(PyObject *, PyObject *);
|
||||
static PyObject *CurrentGetattro(PyObject *, PyObject *);
|
||||
static int CurrentSetattro(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject *DictionaryGetattro(PyObject *, PyObject *);
|
||||
static int DictionarySetattro(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject *ListGetattro(PyObject *, PyObject *);
|
||||
static int ListSetattro(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject *FunctionGetattro(PyObject *, PyObject *);
|
||||
|
||||
static struct PyModuleDef vimmodule;
|
||||
|
||||
/*
|
||||
* Include the code shared with if_python.c
|
||||
*/
|
||||
#include "if_py_both.h"
|
||||
|
||||
#define GET_ATTR_STRING(name, nameobj) \
|
||||
char *name = ""; \
|
||||
if (PyUnicode_Check(nameobj)) \
|
||||
name = _PyUnicode_AsString(nameobj)
|
||||
|
||||
#define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
|
||||
|
||||
/******************************************************
|
||||
* Internal function prototypes.
|
||||
*/
|
||||
|
||||
static Py_ssize_t RangeStart;
|
||||
static Py_ssize_t RangeEnd;
|
||||
|
||||
static PyObject *globals;
|
||||
|
||||
static int PythonIO_Init(void);
|
||||
@@ -1042,7 +1060,7 @@ static PySequenceMethods BufferAsSeq = {
|
||||
0, /* sq_inplace_repeat */
|
||||
};
|
||||
|
||||
PyMappingMethods BufferAsMapping = {
|
||||
static PyMappingMethods BufferAsMapping = {
|
||||
/* mp_length */ (lenfunc)BufferLength,
|
||||
/* mp_subscript */ (binaryfunc)BufferSubscript,
|
||||
/* mp_ass_subscript */ (objobjargproc)BufferAsSubscript,
|
||||
@@ -1052,8 +1070,6 @@ PyMappingMethods BufferAsMapping = {
|
||||
/* Buffer object - Definitions
|
||||
*/
|
||||
|
||||
static PyTypeObject BufferType;
|
||||
|
||||
static PyObject *
|
||||
BufferNew(buf_T *buf)
|
||||
{
|
||||
@@ -1090,31 +1106,19 @@ BufferNew(buf_T *buf)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
BufferDestructor(PyObject *self)
|
||||
{
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
|
||||
if (this->buf && this->buf != INVALID_BUFFER_VALUE)
|
||||
this->buf->b_python3_ref = NULL;
|
||||
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferGetattro(PyObject *self, PyObject*nameobj)
|
||||
{
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
PyObject *r;
|
||||
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
|
||||
if (CheckBuffer(this))
|
||||
if (CheckBuffer((BufferObject *)(self)))
|
||||
return NULL;
|
||||
|
||||
if (strcmp(name, "name") == 0)
|
||||
return Py_BuildValue("s", this->buf->b_ffname);
|
||||
else if (strcmp(name, "number") == 0)
|
||||
return Py_BuildValue("n", this->buf->b_fnum);
|
||||
r = BufferAttr((BufferObject *)(self), name);
|
||||
if (r || PyErr_Occurred())
|
||||
return r;
|
||||
else
|
||||
return PyObject_GenericGetAttr(self, nameobj);
|
||||
}
|
||||
@@ -1126,35 +1130,6 @@ BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
|
||||
"append", "mark", "range");
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferRepr(PyObject *self)
|
||||
{
|
||||
static char repr[100];
|
||||
BufferObject *this = (BufferObject *)(self);
|
||||
|
||||
if (this->buf == INVALID_BUFFER_VALUE)
|
||||
{
|
||||
vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
|
||||
return PyUnicode_FromString(repr);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *name = (char *)this->buf->b_fname;
|
||||
Py_ssize_t len;
|
||||
|
||||
if (name == NULL)
|
||||
name = "";
|
||||
len = strlen(name);
|
||||
|
||||
if (len > 35)
|
||||
name = name + (35 - len);
|
||||
|
||||
vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
|
||||
|
||||
return PyUnicode_FromString(repr);
|
||||
}
|
||||
}
|
||||
|
||||
/******************/
|
||||
|
||||
static Py_ssize_t
|
||||
@@ -1251,7 +1226,7 @@ static PySequenceMethods RangeAsSeq = {
|
||||
0, /* sq_inplace_repeat */
|
||||
};
|
||||
|
||||
PyMappingMethods RangeAsMapping = {
|
||||
static PyMappingMethods RangeAsMapping = {
|
||||
/* mp_length */ (lenfunc)RangeLength,
|
||||
/* mp_subscript */ (binaryfunc)RangeSubscript,
|
||||
/* mp_ass_subscript */ (objobjargproc)RangeAsSubscript,
|
||||
@@ -1260,13 +1235,6 @@ PyMappingMethods RangeAsMapping = {
|
||||
/* Line range object - Implementation
|
||||
*/
|
||||
|
||||
static void
|
||||
RangeDestructor(PyObject *self)
|
||||
{
|
||||
Py_DECREF(((RangeObject *)(self))->buf);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
RangeGetattro(PyObject *self, PyObject *nameobj)
|
||||
{
|
||||
@@ -1354,15 +1322,9 @@ RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Buffer list object - Definitions
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} BufListObject;
|
||||
|
||||
static PySequenceMethods BufListAsSeq = {
|
||||
(lenfunc) BufListLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* sq_concat, x+y */
|
||||
@@ -1376,18 +1338,6 @@ static PySequenceMethods BufListAsSeq = {
|
||||
0, /* sq_inplace_repeat */
|
||||
};
|
||||
|
||||
static PyTypeObject BufListType;
|
||||
|
||||
/* Window object - Definitions
|
||||
*/
|
||||
|
||||
static struct PyMethodDef WindowMethods[] = {
|
||||
/* name, function, calling, documentation */
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
static PyTypeObject WindowType;
|
||||
|
||||
/* Window object - Implementation
|
||||
*/
|
||||
|
||||
@@ -1425,43 +1375,19 @@ WindowNew(win_T *win)
|
||||
return (PyObject *)(self);
|
||||
}
|
||||
|
||||
static void
|
||||
WindowDestructor(PyObject *self)
|
||||
{
|
||||
WindowObject *this = (WindowObject *)(self);
|
||||
|
||||
if (this->win && this->win != INVALID_WINDOW_VALUE)
|
||||
this->win->w_python3_ref = NULL;
|
||||
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
WindowGetattro(PyObject *self, PyObject *nameobj)
|
||||
{
|
||||
WindowObject *this = (WindowObject *)(self);
|
||||
PyObject *r;
|
||||
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
|
||||
if (CheckWindow(this))
|
||||
if (CheckWindow((WindowObject *)(self)))
|
||||
return NULL;
|
||||
|
||||
if (strcmp(name, "buffer") == 0)
|
||||
return (PyObject *)BufferNew(this->win->w_buffer);
|
||||
else if (strcmp(name, "cursor") == 0)
|
||||
{
|
||||
pos_T *pos = &this->win->w_cursor;
|
||||
|
||||
return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
|
||||
}
|
||||
else if (strcmp(name, "height") == 0)
|
||||
return Py_BuildValue("l", (long)(this->win->w_height));
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
else if (strcmp(name, "width") == 0)
|
||||
return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
|
||||
#endif
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[sss]", "buffer", "cursor", "height");
|
||||
r = WindowAttr((WindowObject *)(self), name);
|
||||
if (r || PyErr_Occurred())
|
||||
return r;
|
||||
else
|
||||
return PyObject_GenericGetAttr(self, nameobj);
|
||||
}
|
||||
@@ -1477,12 +1403,6 @@ WindowSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
/* Window list object - Definitions
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
}
|
||||
WinListObject;
|
||||
|
||||
static PySequenceMethods WinListAsSeq = {
|
||||
(lenfunc) WinListLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* sq_concat, x+y */
|
||||
@@ -1496,61 +1416,20 @@ static PySequenceMethods WinListAsSeq = {
|
||||
0, /* sq_inplace_repeat */
|
||||
};
|
||||
|
||||
static PyTypeObject WinListType;
|
||||
|
||||
/* Current items object - Definitions
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
} CurrentObject;
|
||||
|
||||
static PyTypeObject CurrentType;
|
||||
|
||||
/* Current items object - Implementation
|
||||
*/
|
||||
static PyObject *
|
||||
CurrentGetattro(PyObject *self UNUSED, PyObject *nameobj)
|
||||
CurrentGetattro(PyObject *self, PyObject *nameobj)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
|
||||
if (strcmp(name, "buffer") == 0)
|
||||
return (PyObject *)BufferNew(curbuf);
|
||||
else if (strcmp(name, "window") == 0)
|
||||
return (PyObject *)WindowNew(curwin);
|
||||
else if (strcmp(name, "line") == 0)
|
||||
return GetBufferLine(curbuf, (Py_ssize_t)curwin->w_cursor.lnum);
|
||||
else if (strcmp(name, "range") == 0)
|
||||
return RangeNew(curbuf, RangeStart, RangeEnd);
|
||||
else if (strcmp(name,"__members__") == 0)
|
||||
return Py_BuildValue("[ssss]", "buffer", "window", "line", "range");
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, name);
|
||||
return NULL;
|
||||
}
|
||||
return CurrentGetattr(self, name);
|
||||
}
|
||||
|
||||
static int
|
||||
CurrentSetattro(PyObject *self UNUSED, PyObject *nameobj, PyObject *value)
|
||||
CurrentSetattro(PyObject *self, PyObject *nameobj, PyObject *value)
|
||||
{
|
||||
char *name = "";
|
||||
if (PyUnicode_Check(nameobj))
|
||||
name = _PyUnicode_AsString(nameobj);
|
||||
|
||||
if (strcmp(name, "line") == 0)
|
||||
{
|
||||
if (SetBufferLine(curbuf, (Py_ssize_t)curwin->w_cursor.lnum, value, NULL) == FAIL)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_AttributeError, name);
|
||||
return -1;
|
||||
}
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
return CurrentSetattr(self, name, value);
|
||||
}
|
||||
|
||||
/* Dictionary object - Definitions
|
||||
@@ -1558,12 +1437,6 @@ CurrentSetattro(PyObject *self UNUSED, PyObject *nameobj, PyObject *value)
|
||||
|
||||
static PyInt DictionaryLength(PyObject *);
|
||||
|
||||
static PyMappingMethods DictionaryAsMapping = {
|
||||
/* mp_length */ (lenfunc) DictionaryLength,
|
||||
/* mp_subscript */ (binaryfunc) DictionaryItem,
|
||||
/* mp_ass_subscript */ (objobjargproc) DictionaryAssItem,
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
DictionaryGetattro(PyObject *self, PyObject *nameobj)
|
||||
{
|
||||
@@ -1583,20 +1456,7 @@ DictionaryGetattro(PyObject *self, PyObject *nameobj)
|
||||
DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
return DictionarySetattr((DictionaryObject *) self, name, val);
|
||||
}
|
||||
|
||||
static PyTypeObject DictionaryType;
|
||||
|
||||
static void
|
||||
DictionaryDestructor(PyObject *self)
|
||||
{
|
||||
DictionaryObject *this = (DictionaryObject *)(self);
|
||||
|
||||
pyll_remove(&this->ref, &lastdict);
|
||||
dict_unref(this->dict);
|
||||
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
return DictionarySetattr(self, name, val);
|
||||
}
|
||||
|
||||
/* List object - Definitions
|
||||
@@ -1627,8 +1487,6 @@ static PyMappingMethods ListAsMapping = {
|
||||
/* mp_ass_subscript */ (objobjargproc) ListAsSubscript,
|
||||
};
|
||||
|
||||
static PyTypeObject ListType;
|
||||
|
||||
static PyObject *
|
||||
ListSubscript(PyObject *self, PyObject* idxObject)
|
||||
{
|
||||
@@ -1692,34 +1550,12 @@ ListGetattro(PyObject *self, PyObject *nameobj)
|
||||
ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
return ListSetattr((ListObject *) self, name, val);
|
||||
}
|
||||
|
||||
static void
|
||||
ListDestructor(PyObject *self)
|
||||
{
|
||||
ListObject *this = (ListObject *)(self);
|
||||
|
||||
pyll_remove(&this->ref, &lastlist);
|
||||
list_unref(this->list);
|
||||
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
return ListSetattr(self, name, val);
|
||||
}
|
||||
|
||||
/* Function object - Definitions
|
||||
*/
|
||||
|
||||
static void
|
||||
FunctionDestructor(PyObject *self)
|
||||
{
|
||||
FunctionObject *this = (FunctionObject *) (self);
|
||||
|
||||
func_unref(this->name);
|
||||
PyMem_Del(this->name);
|
||||
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
FunctionGetattro(PyObject *self, PyObject *nameobj)
|
||||
{
|
||||
@@ -1775,10 +1611,6 @@ static CurrentObject TheCurrent =
|
||||
PyObject_HEAD_INIT(&CurrentType)
|
||||
};
|
||||
|
||||
PyDoc_STRVAR(vim_module_doc,"vim python interface\n");
|
||||
|
||||
static struct PyModuleDef vimmodule;
|
||||
|
||||
static PyObject *
|
||||
Py3Init_vim(void)
|
||||
{
|
||||
@@ -1894,124 +1726,3 @@ set_ref_in_python3 (int copyID)
|
||||
{
|
||||
set_ref_in_py(copyID);
|
||||
}
|
||||
|
||||
static void
|
||||
init_structs(void)
|
||||
{
|
||||
vim_memset(&OutputType, 0, sizeof(OutputType));
|
||||
OutputType.tp_name = "vim.message";
|
||||
OutputType.tp_basicsize = sizeof(OutputObject);
|
||||
OutputType.tp_getattro = OutputGetattro;
|
||||
OutputType.tp_setattro = OutputSetattro;
|
||||
OutputType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
OutputType.tp_doc = "vim message object";
|
||||
OutputType.tp_methods = OutputMethods;
|
||||
OutputType.tp_alloc = call_PyType_GenericAlloc;
|
||||
OutputType.tp_new = call_PyType_GenericNew;
|
||||
OutputType.tp_free = call_PyObject_Free;
|
||||
|
||||
vim_memset(&BufferType, 0, sizeof(BufferType));
|
||||
BufferType.tp_name = "vim.buffer";
|
||||
BufferType.tp_basicsize = sizeof(BufferType);
|
||||
BufferType.tp_dealloc = BufferDestructor;
|
||||
BufferType.tp_repr = BufferRepr;
|
||||
BufferType.tp_as_sequence = &BufferAsSeq;
|
||||
BufferType.tp_as_mapping = &BufferAsMapping;
|
||||
BufferType.tp_getattro = BufferGetattro;
|
||||
BufferType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
BufferType.tp_doc = "vim buffer object";
|
||||
BufferType.tp_methods = BufferMethods;
|
||||
BufferType.tp_alloc = call_PyType_GenericAlloc;
|
||||
BufferType.tp_new = call_PyType_GenericNew;
|
||||
BufferType.tp_free = call_PyObject_Free;
|
||||
|
||||
vim_memset(&WindowType, 0, sizeof(WindowType));
|
||||
WindowType.tp_name = "vim.window";
|
||||
WindowType.tp_basicsize = sizeof(WindowObject);
|
||||
WindowType.tp_dealloc = WindowDestructor;
|
||||
WindowType.tp_repr = WindowRepr;
|
||||
WindowType.tp_getattro = WindowGetattro;
|
||||
WindowType.tp_setattro = WindowSetattro;
|
||||
WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
WindowType.tp_doc = "vim Window object";
|
||||
WindowType.tp_methods = WindowMethods;
|
||||
WindowType.tp_alloc = call_PyType_GenericAlloc;
|
||||
WindowType.tp_new = call_PyType_GenericNew;
|
||||
WindowType.tp_free = call_PyObject_Free;
|
||||
|
||||
vim_memset(&BufListType, 0, sizeof(BufListType));
|
||||
BufListType.tp_name = "vim.bufferlist";
|
||||
BufListType.tp_basicsize = sizeof(BufListObject);
|
||||
BufListType.tp_as_sequence = &BufListAsSeq;
|
||||
BufListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
BufferType.tp_doc = "vim buffer list";
|
||||
|
||||
vim_memset(&WinListType, 0, sizeof(WinListType));
|
||||
WinListType.tp_name = "vim.windowlist";
|
||||
WinListType.tp_basicsize = sizeof(WinListType);
|
||||
WinListType.tp_as_sequence = &WinListAsSeq;
|
||||
WinListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
WinListType.tp_doc = "vim window list";
|
||||
|
||||
vim_memset(&RangeType, 0, sizeof(RangeType));
|
||||
RangeType.tp_name = "vim.range";
|
||||
RangeType.tp_basicsize = sizeof(RangeObject);
|
||||
RangeType.tp_dealloc = RangeDestructor;
|
||||
RangeType.tp_repr = RangeRepr;
|
||||
RangeType.tp_as_sequence = &RangeAsSeq;
|
||||
RangeType.tp_as_mapping = &RangeAsMapping;
|
||||
RangeType.tp_getattro = RangeGetattro;
|
||||
RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
RangeType.tp_doc = "vim Range object";
|
||||
RangeType.tp_methods = RangeMethods;
|
||||
RangeType.tp_alloc = call_PyType_GenericAlloc;
|
||||
RangeType.tp_new = call_PyType_GenericNew;
|
||||
RangeType.tp_free = call_PyObject_Free;
|
||||
|
||||
vim_memset(&CurrentType, 0, sizeof(CurrentType));
|
||||
CurrentType.tp_name = "vim.currentdata";
|
||||
CurrentType.tp_basicsize = sizeof(CurrentObject);
|
||||
CurrentType.tp_getattro = CurrentGetattro;
|
||||
CurrentType.tp_setattro = CurrentSetattro;
|
||||
CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
CurrentType.tp_doc = "vim current object";
|
||||
|
||||
vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
|
||||
DictionaryType.tp_name = "vim.dictionary";
|
||||
DictionaryType.tp_basicsize = sizeof(DictionaryObject);
|
||||
DictionaryType.tp_getattro = DictionaryGetattro;
|
||||
DictionaryType.tp_setattro = DictionarySetattro;
|
||||
DictionaryType.tp_dealloc = DictionaryDestructor;
|
||||
DictionaryType.tp_as_mapping = &DictionaryAsMapping;
|
||||
DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
|
||||
DictionaryType.tp_methods = DictionaryMethods;
|
||||
|
||||
vim_memset(&ListType, 0, sizeof(ListType));
|
||||
ListType.tp_name = "vim.list";
|
||||
ListType.tp_dealloc = ListDestructor;
|
||||
ListType.tp_basicsize = sizeof(ListObject);
|
||||
ListType.tp_getattro = ListGetattro;
|
||||
ListType.tp_setattro = ListSetattro;
|
||||
ListType.tp_as_sequence = &ListAsSeq;
|
||||
ListType.tp_as_mapping = &ListAsMapping;
|
||||
ListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
ListType.tp_doc = "list pushing modifications to vim structure";
|
||||
ListType.tp_methods = ListMethods;
|
||||
|
||||
vim_memset(&FunctionType, 0, sizeof(FunctionType));
|
||||
FunctionType.tp_name = "vim.list";
|
||||
FunctionType.tp_basicsize = sizeof(FunctionObject);
|
||||
FunctionType.tp_getattro = FunctionGetattro;
|
||||
FunctionType.tp_dealloc = FunctionDestructor;
|
||||
FunctionType.tp_call = FunctionCall;
|
||||
FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||
FunctionType.tp_doc = "object that calls vim function";
|
||||
FunctionType.tp_methods = FunctionMethods;
|
||||
|
||||
vim_memset(&vimmodule, 0, sizeof(vimmodule));
|
||||
vimmodule.m_name = "vim";
|
||||
vimmodule.m_doc = vim_module_doc;
|
||||
vimmodule.m_size = -1;
|
||||
vimmodule.m_methods = VimMethods;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,14 @@
|
||||
# define rb_int2big rb_int2big_stub
|
||||
#endif
|
||||
|
||||
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 \
|
||||
&& SIZEOF_INT < SIZEOF_LONG
|
||||
/* Ruby 2.0 defines a number of static functions which use rb_fix2int and
|
||||
* rb_num2int if SIZEOF_INT < SIZEOF_LONG (64bit) */
|
||||
# define rb_fix2int rb_fix2int_stub
|
||||
# define rb_num2int rb_num2int_stub
|
||||
#endif
|
||||
|
||||
#include <ruby.h>
|
||||
#ifdef RUBY19_OR_LATER
|
||||
# include <ruby/encoding.h>
|
||||
@@ -352,6 +360,17 @@ VALUE rb_int2big_stub(SIGNED_VALUE x)
|
||||
{
|
||||
return dll_rb_int2big(x);
|
||||
}
|
||||
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 \
|
||||
&& SIZEOF_INT < SIZEOF_LONG
|
||||
long rb_fix2int_stub(VALUE x)
|
||||
{
|
||||
return dll_rb_fix2int(x);
|
||||
}
|
||||
long rb_num2int_stub(VALUE x)
|
||||
{
|
||||
return dll_rb_num2int(x);
|
||||
}
|
||||
#endif
|
||||
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
|
||||
VALUE
|
||||
rb_float_new_in_heap(double d)
|
||||
|
||||
@@ -5054,7 +5054,6 @@ vim_fnamencmp(x, y, len)
|
||||
int cx = NUL;
|
||||
int cy = NUL;
|
||||
|
||||
/* TODO: multi-byte characters. */
|
||||
while (len > 0)
|
||||
{
|
||||
cx = PTR2CHAR(px);
|
||||
|
||||
33
src/misc2.c
33
src/misc2.c
@@ -6099,52 +6099,59 @@ pathcmp(p, q, maxlen)
|
||||
int maxlen;
|
||||
{
|
||||
int i;
|
||||
int c1, c2;
|
||||
const char *s = NULL;
|
||||
|
||||
for (i = 0; maxlen < 0 || i < maxlen; ++i)
|
||||
for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i))
|
||||
{
|
||||
c1 = PTR2CHAR((char_u *)p + i);
|
||||
c2 = PTR2CHAR((char_u *)q + i);
|
||||
|
||||
/* End of "p": check if "q" also ends or just has a slash. */
|
||||
if (p[i] == NUL)
|
||||
if (c1 == NUL)
|
||||
{
|
||||
if (q[i] == NUL) /* full match */
|
||||
if (c2 == NUL) /* full match */
|
||||
return 0;
|
||||
s = q;
|
||||
break;
|
||||
}
|
||||
|
||||
/* End of "q": check if "p" just has a slash. */
|
||||
if (q[i] == NUL)
|
||||
if (c2 == NUL)
|
||||
{
|
||||
s = p;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((p_fic ? TOUPPER_LOC(p[i]) != TOUPPER_LOC(q[i]) : p[i] != q[i])
|
||||
if ((p_fic ? MB_TOUPPER(c1) != MB_TOUPPER(c2) : c1 != c2)
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
/* consider '/' and '\\' to be equal */
|
||||
&& !((p[i] == '/' && q[i] == '\\')
|
||||
|| (p[i] == '\\' && q[i] == '/'))
|
||||
&& !((c1 == '/' && c2 == '\\')
|
||||
|| (c1 == '\\' && c2 == '/'))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (vim_ispathsep(p[i]))
|
||||
if (vim_ispathsep(c1))
|
||||
return -1;
|
||||
if (vim_ispathsep(q[i]))
|
||||
if (vim_ispathsep(c2))
|
||||
return 1;
|
||||
return ((char_u *)p)[i] - ((char_u *)q)[i]; /* no match */
|
||||
return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
|
||||
: c1 - c2; /* no match */
|
||||
}
|
||||
}
|
||||
if (s == NULL) /* "i" ran into "maxlen" */
|
||||
return 0;
|
||||
|
||||
c1 = PTR2CHAR((char_u *)s + i);
|
||||
c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i));
|
||||
/* ignore a trailing slash, but not "//" or ":/" */
|
||||
if (s[i + 1] == NUL
|
||||
if (c2 == NUL
|
||||
&& i > 0
|
||||
&& !after_pathsep((char_u *)s, (char_u *)s + i)
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
&& (s[i] == '/' || s[i] == '\\')
|
||||
&& (c1 == '/' || c1 == '\\')
|
||||
#else
|
||||
&& s[i] == '/'
|
||||
&& c1 == '/'
|
||||
#endif
|
||||
)
|
||||
return 0; /* match with trailing slash */
|
||||
|
||||
@@ -3493,13 +3493,14 @@ mch_setmouse(on)
|
||||
* 4 = Windows Cross Hair
|
||||
* 5 = Windows UP Arrow
|
||||
*/
|
||||
#ifdef JSBTERM_MOUSE_NONADVANCED /* Disables full feedback of pointer movements */
|
||||
# ifdef JSBTERM_MOUSE_NONADVANCED
|
||||
/* Disables full feedback of pointer movements */
|
||||
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK1Q\033\\",
|
||||
ESC_STR "[0~ZwLMRK1Q" ESC_STR "\\"));
|
||||
#else
|
||||
# else
|
||||
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK+1Q\033\\",
|
||||
ESC_STR "[0~ZwLMRK+1Q" ESC_STR "\\"));
|
||||
#endif
|
||||
# endif
|
||||
ison = TRUE;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -24,8 +24,8 @@ list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
|
||||
int get_spellword __ARGS((list_T *list, char_u **pp));
|
||||
typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd));
|
||||
int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv));
|
||||
void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
|
||||
long call_func_retnr __ARGS((char_u *func, int argc, char_u **argv, int safe));
|
||||
void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
|
||||
void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe));
|
||||
void *save_funccal __ARGS((void));
|
||||
void restore_funccal __ARGS((void *vfc));
|
||||
@@ -95,6 +95,7 @@ char_u *get_tv_string_chk __ARGS((typval_T *varp));
|
||||
char_u *get_var_value __ARGS((char_u *name));
|
||||
void new_script_vars __ARGS((scid_T id));
|
||||
void init_var_dict __ARGS((dict_T *dict, dictitem_T *dict_var, int scope));
|
||||
void unref_var_dict __ARGS((dict_T *dict));
|
||||
void vars_clear __ARGS((hashtab_T *ht));
|
||||
void copy_tv __ARGS((typval_T *from, typval_T *to));
|
||||
void ex_echo __ARGS((exarg_T *eap));
|
||||
|
||||
@@ -48,8 +48,8 @@ int del_history_idx __ARGS((int histype, int idx));
|
||||
void remove_key_from_history __ARGS((void));
|
||||
int get_list_range __ARGS((char_u **str, int *num1, int *num2));
|
||||
void ex_history __ARGS((exarg_T *eap));
|
||||
void prepare_viminfo_history __ARGS((int asklen));
|
||||
int read_viminfo_history __ARGS((vir_T *virp));
|
||||
void prepare_viminfo_history __ARGS((int asklen, int writing));
|
||||
int read_viminfo_history __ARGS((vir_T *virp, int writing));
|
||||
void finish_viminfo_history __ARGS((void));
|
||||
void write_viminfo_history __ARGS((FILE *fp));
|
||||
void cmd_pchar __ARGS((int c, int offset));
|
||||
|
||||
@@ -1611,7 +1611,7 @@ struct file_buffer
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
dictitem_T b_bufvar; /* variable for "b:" Dictionary */
|
||||
dict_T b_vars; /* internal variables, local to buffer */
|
||||
dict_T *b_vars; /* internal variables, local to buffer */
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
|
||||
@@ -1757,7 +1757,7 @@ struct tabpage_S
|
||||
frame_T *(tp_snapshot[SNAP_COUNT]); /* window layout snapshots */
|
||||
#ifdef FEAT_EVAL
|
||||
dictitem_T tp_winvar; /* variable for "t:" Dictionary */
|
||||
dict_T tp_vars; /* internal variables, local to tab page */
|
||||
dict_T *tp_vars; /* internal variables, local to tab page */
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -2080,7 +2080,7 @@ struct window_S
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
dictitem_T w_winvar; /* variable for "w:" Dictionary */
|
||||
dict_T w_vars; /* internal variables, local to window */
|
||||
dict_T *w_vars; /* internal variables, local to window */
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_RIGHTLEFT) && defined(FEAT_FKMAP)
|
||||
|
||||
10
src/term.c
10
src/term.c
@@ -4134,18 +4134,18 @@ check_termcode(max_offset, buf, bufsize, buflen)
|
||||
/* eat it when it has 2 arguments and ends in 'R' */
|
||||
if (j == 1 && tp[i] == 'R')
|
||||
{
|
||||
char *p = NULL;
|
||||
char *aw = NULL;
|
||||
|
||||
u7_status = U7_GOT;
|
||||
# ifdef FEAT_AUTOCMD
|
||||
did_cursorhold = TRUE;
|
||||
# endif
|
||||
if (extra == 2)
|
||||
p = "single";
|
||||
aw = "single";
|
||||
else if (extra == 3)
|
||||
p = "double";
|
||||
if (p != NULL)
|
||||
set_option_value((char_u *)"ambw", 0L, (char_u *)p, 0);
|
||||
aw = "double";
|
||||
if (aw != NULL)
|
||||
set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
|
||||
key_name[0] = (int)KS_EXTRA;
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
slen = i + 1;
|
||||
|
||||
@@ -32,7 +32,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test71.out test72.out test73.out test74.out test75.out \
|
||||
test76.out test77.out test78.out test79.out test80.out \
|
||||
test81.out test82.out test83.out test84.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
@@ -142,3 +143,4 @@ test90.out: test90.in
|
||||
test91.out: test91.in
|
||||
test92.out: test92.in
|
||||
test93.out: test93.in
|
||||
test94.out: test94.in
|
||||
|
||||
@@ -31,7 +31,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test74.out test75.out test76.out test77.out test78.out \
|
||||
test79.out test80.out test81.out test82.out test83.out \
|
||||
test84.out test85.out test86.out test87.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
|
||||
SCRIPTS32 = test50.out test70.out
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test74.out test75.out test76.out test77.out test78.out \
|
||||
test79.out test80.out test81.out test82.out test83.out \
|
||||
test84.out test85.out test86.out test87.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
|
||||
SCRIPTS32 = test50.out test70.out
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test71.out test72.out test73.out test74.out test75.out \
|
||||
test76.out test77.out test78.out test79.out test80.out \
|
||||
test81.out test82.out test83.out test84.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||
#
|
||||
# Last change: 2013-02-21
|
||||
# Last change: 2013 Apr 12
|
||||
#
|
||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||
# Edit the lines in the Configuration section below to select.
|
||||
@@ -77,7 +77,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
||||
test71.out test72.out test74.out test75.out test76.out \
|
||||
test77.out test78.out test79.out test80.out test81.out \
|
||||
test82.out test83.out test84.out test88.out test89.out \
|
||||
test90.out test91.out test92.out test93.out
|
||||
test90.out test91.out test92.out test93.out test94.out
|
||||
|
||||
# Known problems:
|
||||
# Test 30: a problem around mac format - unknown reason
|
||||
|
||||
@@ -28,7 +28,8 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
||||
test74.out test75.out test76.out test77.out test78.out \
|
||||
test79.out test80.out test81.out test82.out test83.out \
|
||||
test84.out test85.out test86.out test87.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
|
||||
SCRIPTS_GUI = test16.out
|
||||
|
||||
@@ -68,8 +69,10 @@ test1.out: test1.in
|
||||
.in.out:
|
||||
-rm -rf $*.failed test.ok $(RM_ON_RUN)
|
||||
cp $*.ok test.ok
|
||||
# Sleep a moment to avoid that the xterm title is messed up
|
||||
@-sleep .2
|
||||
# Sleep a moment to avoid that the xterm title is messed up.
|
||||
# 200 msec is sufficient, but only modern sleep supports a fraction of
|
||||
# a second, fall back to a second if it fails.
|
||||
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
|
||||
-$(RUN_VIM) $*.in
|
||||
|
||||
# For flaky tests retry one time.
|
||||
|
||||
Binary file not shown.
@@ -33,6 +33,49 @@ STARTTEST
|
||||
:let res = "FAILED"
|
||||
:endif
|
||||
:call setline(search("^3"), "circular test " . res)
|
||||
|
||||
:let l = []
|
||||
:lua l = vim.eval("l")
|
||||
:lua l:add(123)
|
||||
:lua l:add("abc")
|
||||
:lua l:add(vim.eval("[1, 2, 3]"))
|
||||
:lua l:add(vim.eval("{'a':1, 'b':2, 'c':3}"))
|
||||
:lua l:insert(123)
|
||||
:lua l:insert("abc")
|
||||
:lua l:insert(vim.eval("[1, 2, 3]"))
|
||||
:lua l:insert(vim.eval("{'a':1, 'b':2, 'c':3}"))
|
||||
:lua l[0] = l[0]
|
||||
:lua l[1] = l[1]
|
||||
:lua l[2] = l[2]
|
||||
:lua l[3] = l[3]
|
||||
:lua l[0] = 123
|
||||
:lua l[1] = "abc"
|
||||
:lua l[2] = vim.eval("[1, 2, 3]")
|
||||
:lua l[3] = vim.eval("{'a':1, 'b':2, 'c':3}")
|
||||
:lua l[3] = nil
|
||||
:lua l[2] = nil
|
||||
:lua l[1] = nil
|
||||
:lua l[0] = nil
|
||||
:lua l = nil
|
||||
:$put =string(l)
|
||||
|
||||
:let d = {}
|
||||
:lua d = vim.eval("d")
|
||||
:lua d[0] = 123
|
||||
:lua d[1] = "abc"
|
||||
:lua d[2] = vim.eval("[1, 2, 3]")
|
||||
:lua d[3] = vim.eval("{'a':1, 'b':2, 'c':3}")
|
||||
:lua d[4] = d[0]
|
||||
:lua d[5] = d[1]
|
||||
:lua d[6] = d[2]
|
||||
:lua d[7] = d[3]
|
||||
:lua d[3] = nil
|
||||
:lua d[2] = nil
|
||||
:lua d[1] = nil
|
||||
:lua d[0] = nil
|
||||
:lua d = nil
|
||||
:$put =string(d)
|
||||
|
||||
:?^1?,$w! test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
@@ -3,3 +3,5 @@ scalar test OK
|
||||
2 line 2
|
||||
dictionary with list OK
|
||||
circular test OK
|
||||
[123.0, 'abc', [1, 2, 3], {'a': 1, 'b': 2, 'c': 3}]
|
||||
{'4': 123.0, '5': 'abc', '6': [1, 2, 3], '7': {'a': 1, 'b': 2, 'c': 3}}
|
||||
|
||||
@@ -38,7 +38,7 @@ Vim(put):E684:
|
||||
Vim(python):E725:
|
||||
Vim(python):E117:
|
||||
[0.0, 0.0]
|
||||
IndexError
|
||||
KeyError
|
||||
TypeError
|
||||
TypeError
|
||||
ValueError
|
||||
|
||||
@@ -38,7 +38,7 @@ Vim(put):E684:
|
||||
Vim(py3):E725:
|
||||
Vim(py3):E117:
|
||||
[0.0, 0.0]
|
||||
IndexError
|
||||
KeyError
|
||||
TypeError
|
||||
TypeError
|
||||
ValueError
|
||||
|
||||
@@ -4,9 +4,10 @@ vim: set ft=vim :
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:"
|
||||
:" test for getbufvar()
|
||||
:let b:var_num = 1234
|
||||
:let def_num = 5678
|
||||
:" Test for getbufvar()
|
||||
:" Use strings to test for memory leaks.
|
||||
:let b:var_num = '1234'
|
||||
:let def_num = '5678'
|
||||
:$put =string(getbufvar(1, 'var_num'))
|
||||
:$put =string(getbufvar(1, 'var_num', def_num))
|
||||
:$put =string(getbufvar(1, ''))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
start:
|
||||
1234
|
||||
1234
|
||||
{'var_num': 1234}
|
||||
{'var_num': 1234}
|
||||
5678
|
||||
'1234'
|
||||
'1234'
|
||||
{'var_num': '1234'}
|
||||
{'var_num': '1234'}
|
||||
'5678'
|
||||
{}
|
||||
{}
|
||||
''
|
||||
5678
|
||||
'5678'
|
||||
0
|
||||
0
|
||||
'Dance'
|
||||
|
||||
98
src/testdir/test94.in
Normal file
98
src/testdir/test94.in
Normal file
@@ -0,0 +1,98 @@
|
||||
Test for Visual mode and operators
|
||||
|
||||
Tests for the two kinds of operations: Those executed with Visual mode
|
||||
followed by an operator and those executed via Operator-pending mode. Also
|
||||
part of the test are mappings, counts, and repetition with the . command.
|
||||
|
||||
Test cases:
|
||||
- Visual modes (v V CTRL-V) followed by an operator; count; repeating
|
||||
- Visual mode maps; count; repeating
|
||||
- Simple
|
||||
- With an Ex command (custom text object)
|
||||
- Operator-pending mode maps
|
||||
- Simple
|
||||
- With Ex command moving the cursor
|
||||
- With Ex command and Visual selection (custom text object)
|
||||
- Patch 7.3.879: Properly abort Ex command in Operator-pending mode
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:set nocp
|
||||
:
|
||||
:" User functions
|
||||
:function MoveToCap()
|
||||
: call search('\u', 'W')
|
||||
:endfunction
|
||||
:function SelectInCaps()
|
||||
: let [line1, col1] = searchpos('\u', 'bcnW')
|
||||
: let [line2, col2] = searchpos('.\u', 'nW')
|
||||
: call setpos("'<", [0, line1, col1, 0])
|
||||
: call setpos("'>", [0, line2, col2, 0])
|
||||
: normal! gv
|
||||
:endfunction
|
||||
:function MoveToEndCount(count)
|
||||
: normal! v:count . e
|
||||
:endfunction
|
||||
:
|
||||
:" Visual modes followed by operator
|
||||
/^apple
|
||||
lvld.l3vd.:
|
||||
/^line 1
|
||||
Vcnewlinej.j2Vd.:
|
||||
/^xxxx
|
||||
jlc l.l2c----l.:
|
||||
:
|
||||
:" Visual mode maps (movement and text object)
|
||||
:vnoremap W /\u/s-1<CR>
|
||||
:vnoremap iW :<C-U>call SelectInCaps()<CR>
|
||||
/^Kiwi
|
||||
vWcNol.fD2vd.:
|
||||
/^Jambu
|
||||
llviWc-l.l2vdl.:
|
||||
:
|
||||
:" Operator-pending mode maps (movement and text object)
|
||||
:onoremap W /\u/<CR>
|
||||
:onoremap <Leader>W :<C-U>call MoveToCap()<CR>
|
||||
:onoremap iW :<C-U>call SelectInCaps()<CR>
|
||||
/^Pineapple
|
||||
cW-l.l2.l.:
|
||||
/^Juniper
|
||||
g?\WfD.:
|
||||
/^Lemon
|
||||
yiWPlciWNew:
|
||||
:
|
||||
:" Patch 7.3.879: Properly abort Operator-pending mode for "dv:<Esc>" etc.
|
||||
/^zzzz
|
||||
dV:
|
||||
dv:
|
||||
:set noma | let v:errmsg = ''
|
||||
d:
|
||||
:set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed'
|
||||
dv:dV::set noma | let v:errmsg = ''
|
||||
d::set ma | put = v:errmsg =~# '^E21' ? 'failed' : 'ok'
|
||||
:/^start:/+2,$w! test.out
|
||||
:q!
|
||||
ENDTEST
|
||||
|
||||
start:
|
||||
|
||||
apple banana cherry
|
||||
|
||||
line 1 line 1
|
||||
line 2 line 2
|
||||
line 3 line 3
|
||||
line 4 line 4
|
||||
line 5 line 5
|
||||
line 6 line 6
|
||||
|
||||
xxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxx
|
||||
|
||||
KiwiRaspberryDateWatermelonPeach
|
||||
JambuRambutanBananaTangerineMango
|
||||
|
||||
PineappleQuinceLoganberryOrangeGrapefruitKiwiZ
|
||||
JuniperDurianZ
|
||||
LemonNectarineZ
|
||||
20
src/testdir/test94.ok
Normal file
20
src/testdir/test94.ok
Normal file
@@ -0,0 +1,20 @@
|
||||
a y
|
||||
|
||||
newline
|
||||
newline
|
||||
|
||||
--------x
|
||||
--------x
|
||||
xxxx--------x
|
||||
xxxx--------x
|
||||
|
||||
NoNoberryach
|
||||
--ago
|
||||
|
||||
----Z
|
||||
WhavcreQhevnaZ
|
||||
LemonNewNectarineZ
|
||||
|
||||
zzz
|
||||
ok
|
||||
ok
|
||||
13
src/ui.c
13
src/ui.c
@@ -1458,7 +1458,7 @@ clip_gen_request_selection(cbd)
|
||||
|
||||
int
|
||||
clip_gen_owner_exists(cbd)
|
||||
VimClipboard *cbd;
|
||||
VimClipboard *cbd UNUSED;
|
||||
{
|
||||
#ifdef FEAT_XCLIPBOARD
|
||||
# ifdef FEAT_GUI_GTK
|
||||
@@ -2134,7 +2134,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
||||
text_prop.encoding = *type;
|
||||
text_prop.format = *format;
|
||||
text_prop.nitems = len;
|
||||
#ifdef FEAT_MBYTE
|
||||
#if defined(FEAT_MBYTE) && defined(X_HAVE_UTF8_STRING)
|
||||
if (*type == utf8_atom)
|
||||
status = Xutf8TextPropertyToTextList(X_DISPLAY, &text_prop,
|
||||
&text_list, &n_text);
|
||||
@@ -2196,8 +2196,13 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
default: type = XA_STRING;
|
||||
}
|
||||
#ifdef FEAT_MBYTE
|
||||
if (type == utf8_atom && !enc_utf8)
|
||||
/* Only request utf-8 when 'encoding' is utf8. */
|
||||
if (type == utf8_atom
|
||||
# if defined(X_HAVE_UTF8_STRING)
|
||||
&& !enc_utf8
|
||||
# endif
|
||||
)
|
||||
/* Only request utf-8 when 'encoding' is utf8 and
|
||||
* Xutf8TextPropertyToTextList is available. */
|
||||
continue;
|
||||
#endif
|
||||
success = MAYBE;
|
||||
|
||||
@@ -216,6 +216,7 @@ u_check(int newhead_may_be_NULL)
|
||||
|
||||
/*
|
||||
* Save the current line for both the "u" and "U" command.
|
||||
* Careful: may trigger autocommands that reload the buffer.
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
int
|
||||
@@ -238,8 +239,9 @@ u_save(top, bot)
|
||||
if (undo_off)
|
||||
return OK;
|
||||
|
||||
if (top > curbuf->b_ml.ml_line_count ||
|
||||
top >= bot || bot > curbuf->b_ml.ml_line_count + 1)
|
||||
if (top > curbuf->b_ml.ml_line_count
|
||||
|| top >= bot
|
||||
|| bot > curbuf->b_ml.ml_line_count + 1)
|
||||
return FALSE; /* rely on caller to do error messages */
|
||||
|
||||
if (top + 2 == bot)
|
||||
|
||||
@@ -728,6 +728,60 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
910,
|
||||
/**/
|
||||
909,
|
||||
/**/
|
||||
908,
|
||||
/**/
|
||||
907,
|
||||
/**/
|
||||
906,
|
||||
/**/
|
||||
905,
|
||||
/**/
|
||||
904,
|
||||
/**/
|
||||
903,
|
||||
/**/
|
||||
902,
|
||||
/**/
|
||||
901,
|
||||
/**/
|
||||
900,
|
||||
/**/
|
||||
899,
|
||||
/**/
|
||||
898,
|
||||
/**/
|
||||
897,
|
||||
/**/
|
||||
896,
|
||||
/**/
|
||||
895,
|
||||
/**/
|
||||
894,
|
||||
/**/
|
||||
893,
|
||||
/**/
|
||||
892,
|
||||
/**/
|
||||
891,
|
||||
/**/
|
||||
890,
|
||||
/**/
|
||||
889,
|
||||
/**/
|
||||
888,
|
||||
/**/
|
||||
887,
|
||||
/**/
|
||||
886,
|
||||
/**/
|
||||
885,
|
||||
/**/
|
||||
884,
|
||||
/**/
|
||||
883,
|
||||
/**/
|
||||
|
||||
133
src/window.c
133
src/window.c
@@ -2070,6 +2070,7 @@ close_windows(buf, keep_curwin)
|
||||
|
||||
--RedrawingDisabled;
|
||||
|
||||
redraw_tabline = TRUE;
|
||||
if (h != tabline_height())
|
||||
shell_new_rows();
|
||||
}
|
||||
@@ -3457,25 +3458,35 @@ win_init_size()
|
||||
alloc_tabpage()
|
||||
{
|
||||
tabpage_T *tp;
|
||||
# ifdef FEAT_GUI
|
||||
int i;
|
||||
# endif
|
||||
|
||||
|
||||
tp = (tabpage_T *)alloc_clear((unsigned)sizeof(tabpage_T));
|
||||
if (tp != NULL)
|
||||
{
|
||||
# ifdef FEAT_GUI
|
||||
int i;
|
||||
if (tp == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
tp->tp_prev_which_scrollbars[i] = -1;
|
||||
# ifdef FEAT_EVAL
|
||||
/* init t: variables */
|
||||
tp->tp_vars = dict_alloc();
|
||||
if (tp->tp_vars == NULL)
|
||||
{
|
||||
vim_free(tp);
|
||||
return NULL;
|
||||
}
|
||||
init_var_dict(tp->tp_vars, &tp->tp_winvar, VAR_SCOPE);
|
||||
# endif
|
||||
|
||||
# ifdef FEAT_GUI
|
||||
for (i = 0; i < 3; i++)
|
||||
tp->tp_prev_which_scrollbars[i] = -1;
|
||||
# endif
|
||||
# ifdef FEAT_DIFF
|
||||
tp->tp_diff_invalid = TRUE;
|
||||
tp->tp_diff_invalid = TRUE;
|
||||
# endif
|
||||
#ifdef FEAT_EVAL
|
||||
/* init t: variables */
|
||||
init_var_dict(&tp->tp_vars, &tp->tp_winvar, VAR_SCOPE);
|
||||
#endif
|
||||
tp->tp_ch_used = p_ch;
|
||||
}
|
||||
tp->tp_ch_used = p_ch;
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
@@ -3491,7 +3502,9 @@ free_tabpage(tp)
|
||||
for (idx = 0; idx < SNAP_COUNT; ++idx)
|
||||
clear_snapshot(tp, idx);
|
||||
#ifdef FEAT_EVAL
|
||||
vars_clear(&tp->tp_vars.dv_hashtab); /* free all t: variables */
|
||||
vars_clear(&tp->tp_vars->dv_hashtab); /* free all t: variables */
|
||||
hash_init(&tp->tp_vars->dv_hashtab);
|
||||
unref_var_dict(tp->tp_vars);
|
||||
#endif
|
||||
vim_free(tp);
|
||||
}
|
||||
@@ -4363,71 +4376,79 @@ win_alloc(after, hidden)
|
||||
* allocate window structure and linesizes arrays
|
||||
*/
|
||||
new_wp = (win_T *)alloc_clear((unsigned)sizeof(win_T));
|
||||
if (new_wp != NULL && win_alloc_lines(new_wp) == FAIL)
|
||||
if (new_wp == NULL)
|
||||
return NULL;
|
||||
|
||||
if (win_alloc_lines(new_wp) == FAIL)
|
||||
{
|
||||
vim_free(new_wp);
|
||||
new_wp = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (new_wp != NULL)
|
||||
#ifdef FEAT_EVAL
|
||||
/* init w: variables */
|
||||
new_wp->w_vars = dict_alloc();
|
||||
if (new_wp->w_vars == NULL)
|
||||
{
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Don't execute autocommands while the window is not properly
|
||||
* initialized yet. gui_create_scrollbar() may trigger a FocusGained
|
||||
* event. */
|
||||
block_autocmds();
|
||||
win_free_lsize(new_wp);
|
||||
vim_free(new_wp);
|
||||
return NULL;
|
||||
}
|
||||
init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);
|
||||
#endif
|
||||
/*
|
||||
* link the window in the window list
|
||||
*/
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Don't execute autocommands while the window is not properly
|
||||
* initialized yet. gui_create_scrollbar() may trigger a FocusGained
|
||||
* event. */
|
||||
block_autocmds();
|
||||
#endif
|
||||
/*
|
||||
* link the window in the window list
|
||||
*/
|
||||
#ifdef FEAT_WINDOWS
|
||||
if (!hidden)
|
||||
win_append(after, new_wp);
|
||||
if (!hidden)
|
||||
win_append(after, new_wp);
|
||||
#endif
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
new_wp->w_wincol = 0;
|
||||
new_wp->w_width = Columns;
|
||||
new_wp->w_wincol = 0;
|
||||
new_wp->w_width = Columns;
|
||||
#endif
|
||||
|
||||
/* position the display and the cursor at the top of the file. */
|
||||
new_wp->w_topline = 1;
|
||||
/* position the display and the cursor at the top of the file. */
|
||||
new_wp->w_topline = 1;
|
||||
#ifdef FEAT_DIFF
|
||||
new_wp->w_topfill = 0;
|
||||
new_wp->w_topfill = 0;
|
||||
#endif
|
||||
new_wp->w_botline = 2;
|
||||
new_wp->w_cursor.lnum = 1;
|
||||
new_wp->w_botline = 2;
|
||||
new_wp->w_cursor.lnum = 1;
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
new_wp->w_scbind_pos = 1;
|
||||
new_wp->w_scbind_pos = 1;
|
||||
#endif
|
||||
|
||||
/* We won't calculate w_fraction until resizing the window */
|
||||
new_wp->w_fraction = 0;
|
||||
new_wp->w_prev_fraction_row = -1;
|
||||
/* We won't calculate w_fraction until resizing the window */
|
||||
new_wp->w_fraction = 0;
|
||||
new_wp->w_prev_fraction_row = -1;
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
if (gui.in_use)
|
||||
{
|
||||
gui_create_scrollbar(&new_wp->w_scrollbars[SBAR_LEFT],
|
||||
SBAR_LEFT, new_wp);
|
||||
gui_create_scrollbar(&new_wp->w_scrollbars[SBAR_RIGHT],
|
||||
SBAR_RIGHT, new_wp);
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_EVAL
|
||||
/* init w: variables */
|
||||
init_var_dict(&new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);
|
||||
if (gui.in_use)
|
||||
{
|
||||
gui_create_scrollbar(&new_wp->w_scrollbars[SBAR_LEFT],
|
||||
SBAR_LEFT, new_wp);
|
||||
gui_create_scrollbar(&new_wp->w_scrollbars[SBAR_RIGHT],
|
||||
SBAR_RIGHT, new_wp);
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_FOLDING
|
||||
foldInitWin(new_wp);
|
||||
foldInitWin(new_wp);
|
||||
#endif
|
||||
#ifdef FEAT_AUTOCMD
|
||||
unblock_autocmds();
|
||||
unblock_autocmds();
|
||||
#endif
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
new_wp->w_match_head = NULL;
|
||||
new_wp->w_next_match_id = 4;
|
||||
new_wp->w_match_head = NULL;
|
||||
new_wp->w_next_match_id = 4;
|
||||
#endif
|
||||
}
|
||||
return new_wp;
|
||||
}
|
||||
|
||||
@@ -4488,7 +4509,9 @@ win_free(wp, tp)
|
||||
clear_winopt(&wp->w_allbuf_opt);
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
vars_clear(&wp->w_vars.dv_hashtab); /* free all w: variables */
|
||||
vars_clear(&wp->w_vars->dv_hashtab); /* free all w: variables */
|
||||
hash_init(&wp->w_vars->dv_hashtab);
|
||||
unref_var_dict(wp->w_vars);
|
||||
#endif
|
||||
|
||||
if (prevwin == wp)
|
||||
|
||||
Reference in New Issue
Block a user