• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521559

30 May 2025 06:24AM UTC coverage: 82.248% (-0.03%) from 82.275%
#525521559

push

github

hurricup
Suppressed SameParameterValue warning

30866 of 37528 relevant lines covered (82.25%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.0
/plugin/core/src/main/java/com/perl5/lang/perl/parser/builder/PerlBuilder.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.perl.parser.builder;
18

19
import com.intellij.lang.PsiBuilder;
20
import com.intellij.lang.PsiParser;
21
import com.intellij.lang.parser.GeneratedParserUtilBase;
22
import com.intellij.psi.tree.IElementType;
23
import com.perl5.lang.perl.lexer.PerlElementTypes;
24
import com.perl5.lang.perl.lexer.PerlTokenSetsEx;
25
import com.perl5.lang.perl.parser.PerlParserImpl;
26

27
/**
28
 * This wrapper created to be able to store per-parsing data like pragmas, warnings and variables ?
29
 */
30
public class PerlBuilder extends GeneratedParserUtilBase.Builder implements PerlElementTypes {
1✔
31
  private final PerlParserImpl perlParser;
32

33
  // flags that sq strings should be converted to the use_vars_lazy_parsable_strings
34
  boolean isUseVarsContent = false;
1✔
35
  // flag allowes special variable names
36
  boolean isSpecialVariableNamesAllowed = true;
1✔
37

38
  public PerlBuilder(PsiBuilder builder, GeneratedParserUtilBase.ErrorState state, PsiParser parser) {
39
    super(builder, state, parser);
1✔
40
    perlParser = (PerlParserImpl)parser;
1✔
41
  }
1✔
42

43
  /**
44
   * Return token ahead of current, skips spaces and comments
45
   *
46
   * @param steps positive or negative steps number to get token
47
   * @return token data: type and text
48
   */
49
  public IElementType lookupToken(int steps) {
50
    assert steps != 0;
1✔
51
    int rawStep = 0;
1✔
52
    int step = steps / Math.abs(steps);
1✔
53

54
    IElementType rawTokenType = null;
1✔
55

56
    while (steps != 0) {
1✔
57
      rawStep += step;
1✔
58
      rawTokenType = rawLookup(rawStep);
1✔
59

60
      // reached end
61
      if (rawTokenType == null) {
1✔
62
        return null;
×
63
      }
64

65
      if (!PerlTokenSetsEx.getWHITE_SPACE_AND_COMMENTS().contains(rawTokenType)) {
1✔
66
        steps -= step;
1✔
67
      }
68
    }
69

70
    return rawTokenType;
1✔
71
  }
72

73
  public boolean isUseVarsContent() {
74
    return isUseVarsContent;
1✔
75
  }
76

77
  public void setUseVarsContent(boolean newState) {
78
    isUseVarsContent = newState;
1✔
79
  }
1✔
80

81
  public boolean setSpecialVariableNamesAllowed(boolean specialVariableNamesAllowed) {
82
    boolean oldValue = isSpecialVariableNamesAllowed;
1✔
83
    isSpecialVariableNamesAllowed = specialVariableNamesAllowed;
1✔
84
    return oldValue;
1✔
85
  }
86

87
  public PerlParserImpl getPerlParser() {
88
    return perlParser;
1✔
89
  }
90
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc