Skip to content

Commit

Permalink
Engine structure tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
fileformat committed Oct 30, 2024
1 parent 1690777 commit e983517
Show file tree
Hide file tree
Showing 26 changed files with 92 additions and 43 deletions.
39 changes: 39 additions & 0 deletions src/app/internal/list.html/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Level } from '@/components/Level';
import { getEngines } from '@/engines';



export default function List() {

const rows = getEngines().map((engine) => {
return (<tr key={`engine_${engine.handle}`}><td>{engine.short_name}</td><td><Level level={engine.level}/></td></tr>);
});

const total = getEngines().length;
const working = getEngines().filter(engine => engine.test_url).length;

return (
<>
<h1>Engines</h1>
<table className="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Level</th>
</tr>
</thead>
<tbody>
{rows}
</tbody>
</table>
<p>
<Level level="alpha"/>: {getEngines().filter(engine => engine.level === 'alpha').length}<br/>
<Level level="beta"/>: {getEngines().filter(engine => engine.level === 'beta').length}<br/>
<Level level="golden"/>: {getEngines().filter(engine => engine.level === 'golden').length}<br/>
Total working: {working}<br />
<Level level="notimplemented"/>: {getEngines().filter(engine => engine.level === 'notimplemented').length}<br/>
Grand total: {total}
</p>
</>
);
}
3 changes: 2 additions & 1 deletion src/app/robots.txt/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Disallow: /
Sitemap: https://www.regexplanet.com/sitemap.xml
User-agent: *
Disallow: /int
Disallow: /honeypot.txt
`
`;
}

return new Response(robotsTxt, {
Expand Down
19 changes: 19 additions & 0 deletions src/components/Level.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type LevelProps = {
level: string;
}

export function Level({ level }: LevelProps) {
if (level === 'alpha') {
return (<span className="badge bg-danger">{level}</span>);
}
if (level === 'beta') {
return (<span className="badge bg-warning">{level}</span>);
}
if (level === 'golden') {
return (<span className="badge bg-success">{level}</span>);
}
if (level === 'notimplemented') {
return (<i>(not implemented yet)</i>);
}
return (<>{level}</>)
}
2 changes: 1 addition & 1 deletion src/components/TestResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function TestResults({ onClear, testOutput }: props) {
return (
<>
<h2 className="pt-3">Results <button className="btn btn-outline-primary btn-sm" onClick={onClear}>Clear</button></h2>
{ testOutput.message ? <div className={messageClass}>{testOutput.message}</div> : <></>}
{ testOutput.message && testOutput.message != "OK" ? <div className={messageClass}>{testOutput.message}</div> : <></>}
{ testOutput.html ? <div dangerouslySetInnerHTML={{ __html: testOutput.html }} /> : <></> }
<hr/>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/engines/RegexEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type RegexEngine = {
links: Record<string, string>; // A map of (name: url) for other help links. These will be displayed on the support page under “Official Documentation”
logo_icon: string; // SVG icon (just the logo, no text) in a square
logo_ar21: string; // SVG logo (including language name) in a 2:1 aspect ratio
nodeping_url?: string; // URL of the nodeping status page
nodeping_id: string; // ID of the nodeping status check
notfound?: string[]; // A list of handles that this is a substitute for (i.e. nodejs is a substitute for javascript)
options: RegexOption[]; // A list of which options it supports.
option_notes?: string; // Notes to display on the options page (html allowed)
Expand Down
4 changes: 2 additions & 2 deletions src/engines/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export const browser: RegexEngine = {
help_url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
handle: "browser",
level: "alpha",
level: "golden",
links: {},
logo_icon: "/images/browsers/browser-icon.svg",
logo_ar21: "/images/browsers/browser-ar21.svg",
nodeping_url: undefined,
nodeping_id: "N/A",
notfound: ["javascript", "typescript"],
options: [
{
Expand Down
5 changes: 2 additions & 3 deletions src/engines/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const bun: RegexEngine = {
help_url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
handle: "bun",
level: "beta",
level: "golden",
links: {
"MDN RegExp Object":
"https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp",
Expand All @@ -16,8 +16,7 @@ export const bun: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/bunsh/bunsh-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/bunsh/bunsh-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/iajucfo0-kq0e-47ql-82sk-xoji0l2ejmfw",
nodeping_id: "iajucfo0-kq0e-47ql-82sk-xoji0l2ejmfw",
notfound: ["javascript", "typescript"],
options: [
{
Expand Down
5 changes: 2 additions & 3 deletions src/engines/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const deno: RegexEngine = {
help_url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
handle: "deno",
level: "beta",
level: "golden",
links: {
"MDN RegExp Object":
"https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp",
Expand All @@ -16,8 +16,7 @@ export const deno: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/deno/deno-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/deno/deno-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/iajucfo0-kq0e-47ql-82sk-xoji0l2ejmfw",
nodeping_id: "9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy",
notfound: ["javascript", "typescript"],
options: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/engines/dotnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ export const dotnet: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/dotnet/dotnet-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/dotnet/dotnet-ar21.svg",
nodeping_id: "9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy",
options: [],
short_name: ".NET",
source_url: "https://github.com/regexplanet/regexplanet-dotnet",
status_url: "https://dotnet.gcr.regexplanet.com/status.json",
test_url: "https://dotnet.gcr.regexplanet.com/test.json",
};
2 changes: 1 addition & 1 deletion src/engines/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const LATER: RegexEngine = {
links: {},
logo_icon: "https://www.vectorlogo.zone/logos/LATER/LATER-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/LATER/LATER-ar21.svg",
nodeping_url: "https://nodeping.com/reports/checks/LATER",
nodeping_id: "LATER",
options: [],
short_name: "LATER",
source_url: "https://github.com/regexplanet/regexplanet-LATER",
Expand Down
1 change: 1 addition & 0 deletions src/engines/erlang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const erlang: RegexEngine = {
links: {},
logo_ar21: "https://www.vectorlogo.zone/logos/erlang/erlang-ar21.svg",
logo_icon: "https://www.vectorlogo.zone/logos/erlang/erlang-icon.svg",
nodeping_id: "LATER",
options: [],
short_name: "Erlang",
};
3 changes: 1 addition & 2 deletions src/engines/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export const go: RegexEngine = {
links: { "re2 syntax": "http://code.google.com/p/re2/wiki/Syntax" },
logo_icon: "https://www.vectorlogo.zone/logos/golang/golang-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/golang/golang-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/cvdmibs4-lyts-48bp-8l93-a4y3ihfrkncc",
nodeping_id: "cvdmibs4-lyts-48bp-8l93-a4y3ihfrkncc",
options: [
{
code: "posix",
Expand Down
5 changes: 2 additions & 3 deletions src/engines/haskell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import type { RegexEngine } from "./RegexEngine";
export const haskell: RegexEngine = {
description: "Text.Regex",
enabled: false,
level: "alpha",
level: "notimplemented",
handle: "haskell",
help_label: "Text.Regex",
help_url:
"http://hackage.haskell.org/package/regex-compat-0.95.1/docs/Text-Regex.html",
nodeping_url:
"https://nodeping.com/reports/checks/kt5c4lp3-80p5-4rzk-8nq2-kqtyvq4p1a2d",
nodeping_id: "kt5c4lp3-80p5-4rzk-8nq2-kqtyvq4p1a2d",
links: {
haskellwiki: "http://www.haskell.org/haskellwiki/Regular_expressions",
"Text.Regex.TDFA":
Expand Down
3 changes: 1 addition & 2 deletions src/engines/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export const java: RegexEngine = {
links: {},
logo_icon: "https://www.vectorlogo.zone/logos/java/java-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/java/java-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/m84cfhq9-gk43-44r5-8mih-syzu6vp45tuk",
nodeping_id: "m84cfhq9-gk43-44r5-8mih-syzu6vp45tuk",
notfound: ["kotlin"],
options: [
{
Expand Down
1 change: 1 addition & 0 deletions src/engines/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const mysql: RegexEngine = {
links: {},
logo_icon: "https://www.vectorlogo.zone/logos/mysql/mysql-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/mysql/mysql-ar21.svg",
nodeping_id: "LATER",
options: [],
short_name: "MySQL",
};
3 changes: 1 addition & 2 deletions src/engines/nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export const nodejs: RegexEngine = {
},
logo_ar21: "https://www.vectorlogo.zone/logos/nodejs/nodejs-ar21.svg",
logo_icon: "https://www.vectorlogo.zone/logos/nodejs/nodejs-icon.svg",
nodeping_url:
"https://nodeping.com/reports/checks/9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy",
nodeping_id: "9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy",
notfound: ["javascript", "typescript"],
options: [
/*{
Expand Down
3 changes: 1 addition & 2 deletions src/engines/perl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export const perl: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/perl/perl-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/perl/perl-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/gkh86985-3ae2-4w7b-8opi-il8pki62v1ie",
nodeping_id: "gkh86985-3ae2-4w7b-8opi-il8pki62v1ie",
options: [
{
code: "m",
Expand Down
5 changes: 2 additions & 3 deletions src/engines/php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ export const php: RegexEngine = {
help_label: "PCRE Overview",
help_url: "http://www.php.net/manual/en/book.pcre.php",
handle: "php",
level: "alpha",
level: "beta",
links: {
"Pattern Modifiers":
"http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php",
},
logo_icon: "https://www.vectorlogo.zone/logos/php/php-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/php/php-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/tv5izwkj-w7m2-4epk-8l9i-2z8y36h0o1n1",
nodeping_id: "tv5izwkj-w7m2-4epk-8l9i-2z8y36h0o1n1",
options: [
{
code: "i",
Expand Down
5 changes: 2 additions & 3 deletions src/engines/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ export const postgresql: RegexEngine = {
help_url:
"https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP",
handle: "postgresql",
level: "alpha",
level: "golden",
links: {
Options:
"https://www.postgresql.org/docs/current/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE",
},
logo_icon: "https://www.vectorlogo.zone/logos/postgresql/postgresql-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/postgresql/postgresql-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/43ytdj0n-jeiu-4zta-8ptc-wr7xmxztp5i8",
nodeping_id: "43ytdj0n-jeiu-4zta-8ptc-wr7xmxztp5i8",
options: [
{ code: "b", description: "rest of RE is a BRE" },
{
Expand Down
3 changes: 1 addition & 2 deletions src/engines/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export const python: RegexEngine = {
links: {},
logo_icon: "https://www.vectorlogo.zone/logos/python/python-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/python/python-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/15fanuwl-znir-46nz-8542-fzsk4fg3zrvg",
nodeping_id: "15fanuwl-znir-46nz-8542-fzsk4fg3zrvg",
options: [
//{ code: "A", legacyCode: "", numericCode: 256, description: "ASCII" },
{
Expand Down
5 changes: 2 additions & 3 deletions src/engines/ruby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export const ruby: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/ruby-lang/ruby-lang-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/ruby-lang/ruby-lang-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/e6od3bui-a5wl-49ff-8698-0cbtjc52rqw1",
nodeping_id: "e6od3bui-a5wl-49ff-8698-0cbtjc52rqw1",
options: [
{
code: "x",
Expand All @@ -38,5 +37,5 @@ export const ruby: RegexEngine = {
short_name: "Ruby",
source_url: "https://github.com/regexplanet/regexplanet-ruby",
status_url: "https://ruby.gcr.regexplanet.com/status.json",
test_url: "https://ruby.gcr.regexplanet.com/status.json",
test_url: "https://ruby.gcr.regexplanet.com/test.json",
};
5 changes: 2 additions & 3 deletions src/engines/rust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const rust: RegexEngine = {
help_label: "docs.rs",
help_url: "https://docs.rs/regex/latest/regex/",
handle: "rust",
level: "alpha",
level: "golden",
links: {
"Struct regex::Regex":
"https://docs.rs/regex/latest/regex/struct.Regex.html",
Expand All @@ -15,8 +15,7 @@ export const rust: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/rust-lang/rust-lang-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/rust-lang/rust-lang-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/ujhwq5rz-ozzd-4uj7-8jth-4osxplhcw4j2",
nodeping_id: "ujhwq5rz-ozzd-4uj7-8jth-4osxplhcw4j2",
options: [],
option_notes: `Rust supports options in the regex pattern and with separate calls to <a href="https://docs.rs/regex/latest/regex/struct.RegexBuilder.html">RegexBuilder</a>.`,
short_name: "Rust",
Expand Down
3 changes: 1 addition & 2 deletions src/engines/swift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export const swift: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/swift/swift-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/swift/swift-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/sd8rr8e8-0vw2-4cur-87tg-tnm9et6pc6w5",
nodeping_id: "sd8rr8e8-0vw2-4cur-87tg-tnm9et6pc6w5",
options: [
{
code: "anchorsMatchLineEndings",
Expand Down
3 changes: 1 addition & 2 deletions src/engines/tcl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export const tcl: RegexEngine = {
links: {},
logo_icon: "https://www.vectorlogo.zone/logos/tcl/tcl-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/tcl/tcl-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/kk4u50sh-kave-4wwx-8f2i-74tgnum8szwa",
nodeping_id: "kk4u50sh-kave-4wwx-8f2i-74tgnum8szwa",
options: [],
short_name: "tcl",
source_url: "https://github.com/regexplanet/regexplanet-tcl",
Expand Down
3 changes: 1 addition & 2 deletions src/engines/xregexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export const xregexp: RegexEngine = {
},
logo_icon: "https://www.vectorlogo.zone/logos/xregexp/xregexp-icon.svg",
logo_ar21: "https://www.vectorlogo.zone/logos/xregexp/xregexp-ar21.svg",
nodeping_url:
"https://nodeping.com/reports/checks/7ysrbqyo-38sg-44au-8j78-g6fpipl8sxho",
nodeping_id: "7ysrbqyo-38sg-44au-8j78-g6fpipl8sxho",
notfound: ["javascript", "typescript"],
options: [
{
Expand Down
1 change: 1 addition & 0 deletions src/types/EngineStatus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
type EngineStatus = {
success: boolean;
version?: string;
detail?: string;
time_millis?: number;
err?: Error;
};
Expand Down

0 comments on commit e983517

Please sign in to comment.