From 5c065a7bba22c8726382127ff10b368f59ce1d69 Mon Sep 17 00:00:00 2001 From: ccremers Date: Wed, 16 Nov 2005 16:49:47 +0000 Subject: [PATCH] - Started generator. --- scripts/if2spdl/Session.vim | 274 +++++++++++++++++++++++++++++++++++ scripts/if2spdl/generator.py | 4 + scripts/if2spdl/if2spdl.py | 5 +- 3 files changed, 281 insertions(+), 2 deletions(-) create mode 100644 scripts/if2spdl/Session.vim create mode 100644 scripts/if2spdl/generator.py diff --git a/scripts/if2spdl/Session.vim b/scripts/if2spdl/Session.vim new file mode 100644 index 0000000..b86d4e4 --- /dev/null +++ b/scripts/if2spdl/Session.vim @@ -0,0 +1,274 @@ +if &cp | set nocp | endif +let s:cpo_save=&cpo +set cpo&vim +imap :call Cream_replacemulti() +map! +nnoremap  :exe 'silent! normal! za'.(foldlevel('.')?'':'l') +map "," :!./parser.py +map , :make +nmap :call Cream_replacemulti() +vmap :call Cream_replacemulti() +map :make +map  +map  +map  +map  +map +let &cpo=s:cpo_save +unlet s:cpo_save +set autoindent +set autowrite +set backspace=2 +set diffopt=filler,iwhite +set fileencodings=ucs-bom,utf-8,default,latin1 +set formatoptions=cqrt +set guifont=Bitstream\ Vera\ Sans\ Mono\ 10 +set guioptions=agirLt +set helplang=en +set history=100 +set ignorecase +set incsearch +set nojoinspaces +set laststatus=2 +set listchars=tab:>.,trail:$ +set makeprg=./if2spdl.py +set printencoding=ascii +set ruler +set scrolloff=2 +set shortmess=at +set showcmd +set nostartofline +set textwidth=72 +set viminfo=%,'50,\"1000,:100,f1,n~/.viminfo +set visualbell +set whichwrap=<,>,h,l +set wildmenu +set window=30 +let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0 +let v:this_session=expand(":p") +silent only +cd ~/svn/scyther/scripts/if2spdl +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +9 parser.py +badd +0 NSPK_LOWE.if1 +badd +8 NSPK_LOWE.if +badd +6 if2spdl.py +badd +0 generator.py +args parser.py +edit generator.py +set splitbelow splitright +wincmd _ | wincmd | +split +1wincmd k +wincmd w +set nosplitbelow +set nosplitright +wincmd t +set winheight=1 winwidth=1 +exe '1resize ' . ((&lines * 15 + 15) / 31) +exe '2resize ' . ((&lines * 13 + 15) / 31) +argglobal +setlocal autoindent +setlocal autoread +setlocal nobinary +setlocal bufhidden= +setlocal buflisted +setlocal buftype= +setlocal nocindent +setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e +setlocal cinoptions= +setlocal cinwords=if,else,while,do,for,switch +setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- +setlocal commentstring=/*%s*/ +setlocal complete=.,w,b,u,t,i +setlocal completefunc= +setlocal nocopyindent +setlocal define= +setlocal dictionary= +setlocal nodiff +setlocal equalprg= +setlocal errorformat= +setlocal noexpandtab +if &filetype != 'python' +setlocal filetype=python +endif +setlocal foldcolumn=0 +setlocal foldenable +setlocal foldexpr=0 +setlocal foldignore=# +setlocal foldlevel=0 +setlocal foldmarker={{{,}}} +setlocal foldmethod=manual +setlocal foldminlines=1 +setlocal foldnestmax=20 +setlocal foldtext=foldtext() +setlocal formatoptions=cqrt +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s* +setlocal grepprg= +setlocal iminsert=2 +setlocal imsearch=2 +setlocal include= +setlocal includeexpr= +setlocal indentexpr=GetPythonIndent(v:lnum) +setlocal indentkeys=0{,0},:,0#,!^F,o,O,e,<:>,=elif,=except +setlocal noinfercase +setlocal iskeyword=@,48-57,_,192-255 +setlocal keywordprg= +setlocal nolinebreak +setlocal nolisp +setlocal nolist +setlocal makeprg= +setlocal matchpairs=(:),{:},[:] +setlocal modeline +setlocal modifiable +setlocal nrformats=octal,hex +setlocal nonumber +setlocal numberwidth=4 +setlocal omnifunc= +setlocal path= +setlocal nopreserveindent +setlocal nopreviewwindow +setlocal quoteescape=\\ +setlocal noreadonly +setlocal noscrollbind +setlocal shiftwidth=8 +setlocal noshortname +setlocal nosmartindent +setlocal softtabstop=0 +setlocal nospell +setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+ +setlocal spellfile= +setlocal spelllang=en +setlocal statusline= +setlocal suffixesadd= +setlocal swapfile +setlocal synmaxcol=3000 +if &syntax != 'python' +setlocal syntax=python +endif +setlocal tabstop=8 +setlocal tags= +setlocal textwidth=72 +setlocal thesaurus= +setlocal nowinfixheight +setlocal wrap +setlocal wrapmargin=0 +silent! normal! zE +let s:l = 4 - ((3 * winheight(0) + 7) / 15) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +4 +normal! 01l +wincmd w +argglobal +edit if2spdl.py +setlocal autoindent +setlocal autoread +setlocal nobinary +setlocal bufhidden= +setlocal buflisted +setlocal buftype= +setlocal nocindent +setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e +setlocal cinoptions= +setlocal cinwords=if,else,while,do,for,switch +setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- +setlocal commentstring=/*%s*/ +setlocal complete=.,w,b,u,t,i +setlocal completefunc= +setlocal nocopyindent +setlocal define= +setlocal dictionary= +setlocal nodiff +setlocal equalprg= +setlocal errorformat= +setlocal noexpandtab +if &filetype != 'python' +setlocal filetype=python +endif +setlocal foldcolumn=0 +setlocal foldenable +setlocal foldexpr=0 +setlocal foldignore=# +setlocal foldlevel=0 +setlocal foldmarker={{{,}}} +setlocal foldmethod=manual +setlocal foldminlines=1 +setlocal foldnestmax=20 +setlocal foldtext=foldtext() +setlocal formatoptions=cqrt +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s* +setlocal grepprg= +setlocal iminsert=2 +setlocal imsearch=2 +setlocal include= +setlocal includeexpr= +setlocal indentexpr=GetPythonIndent(v:lnum) +setlocal indentkeys=0{,0},:,0#,!^F,o,O,e,<:>,=elif,=except +setlocal noinfercase +setlocal iskeyword=@,48-57,_,192-255 +setlocal keywordprg= +setlocal nolinebreak +setlocal nolisp +setlocal nolist +setlocal makeprg= +setlocal matchpairs=(:),{:},[:] +setlocal modeline +setlocal modifiable +setlocal nrformats=octal,hex +setlocal nonumber +setlocal numberwidth=4 +setlocal omnifunc= +setlocal path= +setlocal nopreserveindent +setlocal nopreviewwindow +setlocal quoteescape=\\ +setlocal noreadonly +setlocal noscrollbind +setlocal shiftwidth=8 +setlocal noshortname +setlocal nosmartindent +setlocal softtabstop=0 +setlocal nospell +setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+ +setlocal spellfile= +setlocal spelllang=en +setlocal statusline= +setlocal suffixesadd= +setlocal swapfile +setlocal synmaxcol=3000 +if &syntax != 'python' +setlocal syntax=python +endif +setlocal tabstop=8 +setlocal tags= +setlocal textwidth=72 +setlocal thesaurus= +setlocal nowinfixheight +setlocal wrap +setlocal wrapmargin=0 +silent! normal! zE +let s:l = 13 - ((9 * winheight(0) + 6) / 13) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +13 +normal! 0 +wincmd w +2wincmd w +if exists('s:wipebuf') + exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +exe '1resize ' . ((&lines * 15 + 15) / 31) +exe '2resize ' . ((&lines * 13 + 15) / 31) +set winheight=1 winwidth=20 shortmess=at +let s:sx = expand(":p:r")."x.vim" +if file_readable(s:sx) + exe "source " . s:sx +endif +let &so = s:so_save | let &siso = s:siso_save diff --git a/scripts/if2spdl/generator.py b/scripts/if2spdl/generator.py new file mode 100644 index 0000000..4a4369c --- /dev/null +++ b/scripts/if2spdl/generator.py @@ -0,0 +1,4 @@ +#!/usr/bin/python + +def generateSpdl(ll): + print ll[0] diff --git a/scripts/if2spdl/if2spdl.py b/scripts/if2spdl/if2spdl.py index 0b95712..c7c80fa 100755 --- a/scripts/if2spdl/if2spdl.py +++ b/scripts/if2spdl/if2spdl.py @@ -1,13 +1,14 @@ #!/usr/bin/python from parser import * +from generator import * import pprint def main(): file = open("NSPK_LOWE.if", "r") res = ifParse ("".join(file.readlines() ) ) - pprint.pprint (res.asList()) - + generateSpdl(res) + #pprint.pprint (res.asList()) if __name__ == "__main__":