Skip to content

Commit 57854d5

Browse files
authored
Merge pull request #21 from kadampabookings/prod
June work
2 parents 90c647b + 5b425e4 commit 57854d5

27 files changed

Lines changed: 1177 additions & 633 deletions

File tree

.github/workflows/build-and-deploy-to-sonatype.yml renamed to .github/workflows/build-and-deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
with:
2121
distribution: 'zulu'
2222
java-version: ${{ env.jdk-version }}
23-
server-id: webfx-sonatype-deploy
24-
server-username: SONATYPE_USERNAME
25-
server-password: SONATYPE_PASSWORD
23+
server-id: webfx-sonatype-central-deploy
24+
server-username: SONATYPE_CENTRAL_USERNAME
25+
server-password: SONATYPE_CENTRAL_PASSWORD
2626

2727
# Checkout this repository
2828
- name: Checkout this repository
@@ -32,5 +32,5 @@ jobs:
3232
- name: Deploy this repository
3333
run: mvn -B -P '!gwt-compile,!javafx-fatjar,!javapackager' deploy
3434
env:
35-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
36-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
35+
SONATYPE_CENTRAL_USERNAME: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
36+
SONATYPE_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<repositories>
2222
<repository>
2323
<id>webfx-snapshots</id>
24-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
24+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
2525
<releases>
2626
<enabled>false</enabled>
2727
</releases>

webfx-platform-ast-json-plugin/src/main/java/dev/webfx/platform/ast/json/formatter/JsonFormatterProvider.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ static StringBuilder appendQuoted(String string, StringBuilder sb) {
205205
sb.append(c);
206206
break;
207207
case '/':
208+
// Only escape '/' when it follows '<' (for HTML safety)
208209
if (b == '<') {
209210
sb.append('\\');
210211
}
@@ -227,10 +228,27 @@ static StringBuilder appendQuoted(String string, StringBuilder sb) {
227228
break;
228229
default:
229230
if (c < ' ') {
231+
// Control characters (0x00-0x1F) need to be escaped with Unicode notation
230232
t = "000" + Integer.toHexString(c);
231233
sb.append("\\u").append(t.substring(t.length() - 4));
232-
} else
234+
} else if (c >= '\uD800' && c <= '\uDBFF' && i + 1 < len) {
235+
// Handle surrogate pairs for characters outside the BMP
236+
// High surrogate is between 0xD800 and 0xDBFF
237+
char next = string.charAt(i + 1);
238+
// Low surrogate is between 0xDC00 and 0xDFFF
239+
if (next >= '\uDC00' && next <= '\uDFFF') {
240+
// This is a valid surrogate pair, append both characters
241+
sb.append(c);
242+
sb.append(next);
243+
i++; // Skip the next character as we've already processed it
244+
} else {
245+
// Invalid surrogate pair, just append the current character
246+
sb.append(c);
247+
}
248+
} else {
249+
// Regular character, append as-is
233250
sb.append(c);
251+
}
234252
}
235253
}
236254
return sb.append('"');

webfx-platform-ast-json-plugin/src/main/java/dev/webfx/platform/ast/json/parser/jflex/JsonLexer.flex

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import static dev.webfx.platform.ast.json.parser.javacup.JsonSymbols.*;
99
import dev.webfx.platform.util.Numbers;
1010

1111
%%
12-
12+
1313
/* -----------------Options and Declarations Section----------------- */
1414

1515
%public
@@ -28,17 +28,17 @@ import dev.webfx.platform.util.Numbers;
2828
private Symbol symbol(int type) {
2929
return new Symbol(type, yyline, yycolumn);
3030
}
31-
31+
3232
private Symbol symbol(int type, Object value) {
3333
return new Symbol(type, yyline, yycolumn, value);
3434
}
3535
%}
36-
36+
3737

3838
/*
3939
Macro Declarations
4040
*/
41-
41+
4242
LineTerminator = \r|\n|\r\n
4343
InputCharacter = [^\r\n]
4444
WhiteSpace = {LineTerminator} | [ \t\f]
@@ -60,7 +60,7 @@ Exponent = [eE] [+-]? [0-9]+
6060

6161
%%
6262
/* ------------------------Lexical Rules Section---------------------- */
63-
63+
6464

6565
<YYINITIAL> {
6666

@@ -116,7 +116,13 @@ Exponent = [eE] [+-]? [0-9]+
116116
"\\r" { string.append( '\r' ); }
117117
"\\\"" { string.append( '\"' ); }
118118
"\\\\" { string.append( '\\' ); }
119-
\\. { string.append( yytext() ); }
119+
"\\/" { string.append( '/' ); }
120+
"\\u"[0-9A-Fa-f]{4} {
121+
String hex = yytext().substring(2);
122+
int code = Integer.parseInt(hex, 16);
123+
string.append((char) code);
124+
}
125+
\\. { string.append( yytext().substring(1) ); }
120126

121127
/* error cases */
122128
{LineTerminator} { throw new RuntimeException("Unterminated string at end of line"); }
@@ -135,7 +141,13 @@ Exponent = [eE] [+-]? [0-9]+
135141
"\\r" { string.append( '\r' ); }
136142
"\\\"" { string.append( '\"' ); }
137143
"\\\\" { string.append( '\\' ); }
138-
\\. { string.append( yytext() ); }
144+
"\\/" { string.append( '/' ); }
145+
"\\u"[0-9A-Fa-f]{4} {
146+
String hex = yytext().substring(2);
147+
int code = Integer.parseInt(hex, 16);
148+
string.append((char) code);
149+
}
150+
\\. { string.append( yytext().substring(1) ); }
139151

140152
/* error cases */
141153
{LineTerminator} { throw new RuntimeException("Unterminated string at end of line"); }
@@ -154,7 +166,13 @@ Exponent = [eE] [+-]? [0-9]+
154166
"\\r" { string.append( '\r' ); }
155167
"\\\"" { string.append( '\"' ); }
156168
"\\\\" { string.append( '\\' ); }
157-
\\. { string.append( yytext() ); }
169+
"\\/" { string.append( '/' ); }
170+
"\\u"[0-9A-Fa-f]{4} {
171+
String hex = yytext().substring(2);
172+
int code = Integer.parseInt(hex, 16);
173+
string.append((char) code);
174+
}
175+
\\. { string.append( yytext().substring(1) ); }
158176

159177
/* error cases */
160178
{LineTerminator} { throw new RuntimeException("Unterminated string at end of line"); }

0 commit comments

Comments
 (0)