Adding lookbehind assertion
This commit is contained in:
parent
ac8d90e65a
commit
c092b5fa3a
@ -22,6 +22,12 @@ describe('parser/javascript/subexp.js', function() {
|
||||
'(?!test)': {
|
||||
regexp: jasmine.objectContaining({ textValue: 'test' })
|
||||
},
|
||||
'(?<=test)': {
|
||||
regexp: jasmine.objectContaining({ textValue: 'test' })
|
||||
},
|
||||
'(?<!test)': {
|
||||
regexp: jasmine.objectContaining({ textValue: 'test' })
|
||||
},
|
||||
'(?:test)': {
|
||||
regexp: jasmine.objectContaining({ textValue: 'test' }),
|
||||
proxy: jasmine.objectContaining({ textValue: 'test' })
|
||||
@ -110,6 +116,14 @@ describe('parser/javascript/subexp.js', function() {
|
||||
label: 'negative lookahead',
|
||||
groupCounter: 1
|
||||
},
|
||||
'(?<=test)': {
|
||||
label: 'positive lookbehind',
|
||||
groupCounter: 1
|
||||
},
|
||||
'(?<!test)': {
|
||||
label: 'negative lookbehind',
|
||||
groupCounter: 1
|
||||
},
|
||||
'(?:test)': {
|
||||
label: '',
|
||||
groupCounter: 1
|
||||
|
@ -11,7 +11,7 @@ grammar JavascriptRegexp
|
||||
repeat_spec <- ( "{" min:[0-9]+ "," max:[0-9]+ "}"
|
||||
/ "{" min:[0-9]+ ",}"
|
||||
/ "{" exact:[0-9]+ "}" ) <RepeatSpec>
|
||||
subexp <- "(" capture:( "?<" groupname:name ">" / "?:" / "?=" / "?!" )? regexp ")" <Subexp>
|
||||
subexp <- "(" capture:( "?<" groupname:name ">" / "?:" / "?=" / "?!" / "?<=" / "?<!" )? regexp ")" <Subexp>
|
||||
name <- alpha (alpha / numeric)*
|
||||
alpha <- [a-zA-Z]
|
||||
numeric <- [0-9]
|
||||
|
@ -26,7 +26,9 @@ export default {
|
||||
labelMap: {
|
||||
'?:': '',
|
||||
'?=': 'positive lookahead',
|
||||
'?!': 'negative lookahead'
|
||||
'?!': 'negative lookahead',
|
||||
'?<=': 'positive lookbehind',
|
||||
'?<!': 'negative lookbehind'
|
||||
},
|
||||
|
||||
// Renders the subexp into the currently set container.
|
||||
|
Loading…
Reference in New Issue
Block a user