1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-03 02:07:06 +00:00
1. Fix index, including both start and end. So Literal[start:end+1] will
be a valid part.

2. Replace any with string, add file param type

3. Start of making the evaluator, starting with regexp for param types
(these expression can be changed or/and overriden by user later on)


Former-commit-id: ab95265f953dadbf84170b543e1ff8840f9c4a14
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-03-27 22:33:19 +03:00
parent 251eeb6bd0
commit 126c4de29b
8 changed files with 158 additions and 55 deletions

View File

@@ -11,9 +11,9 @@ type Lexer struct {
ch byte // current char under examination
}
func New(input string) *Lexer {
func New(src string) *Lexer {
l := &Lexer{
input: input,
input: src,
}
// step to the first character in order to be ready
l.readChar()
@@ -86,9 +86,12 @@ func (l *Lexer) newToken(tokenType token.TokenType, lit string) token.Token {
Start: l.pos,
End: l.pos,
}
// remember, l.pos is the last char
// and we want to include both start and end
// in order to be easy to the user to see by just marking the expression
if l.pos > 1 && len(lit) > 1 {
t.End = t.Start + len(lit) - 1
t.End = l.pos - 1
t.Start = t.End - len(lit) + 1
}
return t