regexp: fix NumberFormatException in php (EA-122197)

GitOrigin-RevId: a082b799b351e13d656a10efd350323986dd4b04
This commit is contained in:
Bas Leijdekkers
2019-08-06 11:14:12 +03:00
committed by intellij-monorepo-bot
parent d6f812f06c
commit d5e7f174d0
3 changed files with 5 additions and 33 deletions
@@ -94,7 +94,7 @@ public interface RegExpLanguageHost {
*/
@Nullable
default Number getQuantifierValue(@NotNull RegExpNumber number) {
return Double.parseDouble(number.getText());
return Double.parseDouble(number.getUnescapedText());
}
default Lookbehind supportsLookbehind(@NotNull RegExpGroup lookbehindGroup) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl;
import com.intellij.openapi.module.Module;
@@ -346,7 +332,7 @@ public class JavaRegExpHost implements RegExpLanguageHost {
@Override
public Integer getQuantifierValue(@NotNull RegExpNumber number) {
try {
return Integer.valueOf(number.getText());
return Integer.valueOf(number.getUnescapedText());
}
catch (NumberFormatException e) {
return null;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi.impl;
import com.intellij.icons.AllIcons;
@@ -392,7 +378,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt
@Override
public Long getQuantifierValue(@NotNull RegExpNumber number) {
try {
final long result = Long.parseLong(number.getText());
final long result = Long.parseLong(number.getUnescapedText());
if (result >= 0xFFFFFFFFL /* max unsigned int 32 bits */) return null;
return result;
}