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

Camelcade / Perl5-IDEA / #525521637

21 Jul 2025 12:07PM UTC coverage: 82.347% (+0.08%) from 82.266%
#525521637

push

github

hurricup
#2842 Moved embedded perl extensions

30964 of 37602 relevant lines covered (82.35%)

0.82 hits per line

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

96.0
/plugin/common/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
import org.jetbrains.annotations.Nullable;
27

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

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

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

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

55
    IElementType rawTokenType = null;
1✔
56

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

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

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

71
    return rawTokenType;
1✔
72
  }
73

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

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

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

88
  public PerlParserImpl getPerlParser() {
89
    return perlParser;
1✔
90
  }
91
}
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