Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed "scanf" keyword to "skip"

  • Loading branch information...
commit aa417f274acd8b740aa007118cf728edce952789 1 parent 0e4e953
@dahu authored
View
16 autoload/efmc.vim
@@ -10,7 +10,7 @@ let s:keywords = {
\ 'message' : '%m',
\ 'rest' : '%r',
\ 'pointer' : '%p',
- \ 'scanf' : '%*',
+ \ 'skip' : '%*',
\ 'string' : '%s',
\}
@@ -24,3 +24,17 @@ func! efmc#keyword(elems)
return ''
endif
endfunc
+
+func! efmc#regex(elems)
+ return efmc#efm_escape(join(map(a:elems[1], 'v:val[1]'), ''))
+endfunc
+
+func! efmc#skip(elems)
+ "echom "keyword: " . string(a:elems)
+ return s:keywords['skip'] . a:elems[2]
+endfunc
+
+" stub this for now
+func! efmc#efm_escape(string)
+ return escape(a:string, '\')
+endfunc
View
8 autoload/efmcg.vimpeg
@@ -9,11 +9,15 @@
efm ::= efmline+
efmline ::= efmset | comment
-efmset ::= (whitespace* ( keyword | string | regex))+ eol
-regex ::= '/' ( '\\\\' | '\\/' | !'/' '.' )* '/'
+efmset ::= (whitespace* ( skip | keyword | string | regex))+ eol
+regex ::= '/' ( '\\\\' | '\\/' | !'/' '.' )* '/' -> #regex
string ::= "'" ( "'" "'"+ | !"'" '.' )* "'"
+skip ::= 'skip' whitespace* regex -> #skip
keyword ::= '\a\+' -> #keyword
comment ::= '#.*' eol
whitespace ::= ( '\s' | eol )
eol ::= '\n'
eof ::= '\_$'
+
+; [ [[], '{'], [[...], ' '], [[...], '}'] ]
+
View
2  test/simple_test_driver
@@ -8,7 +8,7 @@ runtime autoload/efmc.vim
let testname = expand('<sfile>:p:t:r')
let testexpr = matchstr(testname, '^test_\d\+_\zs[^_]\+')
exe "edit " . testname . '.in'
-exe "%s/.*/\\=string(g:efmc#parser.GetSym(testexpr).match(submatch(0))['value'])/"
+exe "%s/.*/\\=g:efmc#parser.GetSym(testexpr).match(submatch(0))['value']/"
exe "write " . testname . ".out"
quit!
" vim: set ft=vim:
View
1  test/test_01_keyword_1.in
@@ -7,5 +7,4 @@ number
message
rest
pointer
-scanf
string
View
6 test/test_01_keyword_1.msgout
@@ -1,6 +0,0 @@
-
-"test_01_keyword_1.in"
-"test_01_keyword_1.in" 11L, 68C
-11 substitutions on 11 lines
-"test_01_keyword_1.out"
-"test_01_keyword_1.out" [New] 11L, 55C written
View
21 test/test_01_keyword_1.ok
@@ -1,11 +1,10 @@
-'%f'
-'%l'
-'%c'
-'%v'
-'%t'
-'%n'
-'%m'
-'%r'
-'%p'
-'%*'
-'%s'
+%f
+%l
+%c
+%v
+%t
+%n
+%m
+%r
+%p
+%s
View
11 test/test_01_keyword_1.out
@@ -1,11 +0,0 @@
-'%f'
-'%l'
-'%c'
-'%v'
-'%t'
-'%n'
-'%m'
-'%r'
-'%p'
-'%*'
-'%s'
View
1  test/test_02_skip_1.in
@@ -0,0 +1 @@
+skip /[ ]/
View
1  test/test_02_skip_1.ok
@@ -0,0 +1 @@
+%*[ ]
View
1  test/test_02_skip_1.vim
Please sign in to comment.
Something went wrong with that request. Please try again.