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