ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/el/parser/TesterGenerateIdentifierRanges.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/el/parser/TesterGenerateIdentifierRanges.java
Status
scanned
Type
file
Name
TesterGenerateIdentifierRanges.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3355 (3.3 KB)
MD5
2e4ceb739da7f49c5a6899612dbd7f4c
SHA1
ef9318f516126bf22805d994ca71024d364378fa
SHA256
aa96c31e7f18b5854531ac8ebf830bf22a89ba0885bfed1540453d493e8c157a
SHA512

      
    
SHA1_git
3a069aaca08acdabeb090f44fa9f7e45b749ae21
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TesterGenerateIdentifierRanges.java | 3.3 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ package org.apache.el.parser; import org.junit.Test; /* * The purpose of this class is to generate the ranges used in the JavaCC grammar for EL parsing. * * The ranges for Tomcat 11 were generated with Java 17. * * The generated ranges are unchanged from Java 17 to 18. * * The generated ranges change in Java 19. */ public class TesterGenerateIdentifierRanges { /* * Java Letter is all characters where Character.isJavaIdentifierStart() returns true. */ @Test public void testGenerateJavaLetterRanges() { int start = 0; int end = 0; boolean inRange = false; for (int i = 0 ; i < 0xFFFF; i++) { if (Character.isJavaIdentifierStart(i)) { if (!inRange) { inRange = true; start = i; } } else { if (inRange) { end = i - 1; inRange = false; System.out.print(" \"" + asUnicodeEscape(start) + "\""); if (start == end) { System.out.println(","); } else { System.out.println("-\"" + asUnicodeEscape(end) + "\","); } } } } } /* * Java Digit is all characters where Character.isJavaIdentifierPart() returns true that aren't included in Java * Letter. */ @Test public void testGenerateJavaDigitRanges() { int start = 0; int end = 0; boolean inRange = false; for (int i = 0 ; i < 0xFFFF; i++) { if (Character.isJavaIdentifierPart(i) && !Character.isJavaIdentifierStart(i)) { if (!inRange) { inRange = true; start = i; } } else { if (inRange) { end = i - 1; inRange = false; System.out.print(" \"" + asUnicodeEscape(start) + "\""); if (start == end) { System.out.println(","); } else { System.out.println("-\"" + asUnicodeEscape(end) + "\","); } } } } } private static String asUnicodeEscape(int input) { return String.format("\\u%04x", Integer.valueOf(input)); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
36.28
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9