Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated lexer doc. #522

Merged
merged 1 commit into from Jun 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions autoload/vital/__vital__/Text/Lexer.vim
Expand Up @@ -37,7 +37,7 @@ function! s:obj.exec(string) dict abort
for tkn in self.tokens
let matched_text = matchstr(a:string[(idx):],'^' . tkn.regex)
if ! empty(matched_text)
let best_tkn = s:token(tkn.label,matched_text,idx)
let best_tkn = s:_token(tkn.label,matched_text,idx)
break
endif
endfor
Expand All @@ -59,14 +59,15 @@ function! s:lexer(patterns) abort
return obj
endfunction

function! s:token(label,matched_text,col) abort
function! s:_token(label,matched_text,col) abort
let obj = {}
let obj['label'] = a:label
let obj['matched_text'] = a:matched_text
let obj['col'] = a:col
return obj
endfunction

" Deprecated
function! s:simple_parser(expr) abort
echoerr 'vital: Text.Lexer: simple_parser(expr) is obsolete. Use Text.Parser.parser() instead.'
let obj = { 'expr' : a:expr, 'idx' : 0, 'tokens' : [] }
Expand Down