-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
82 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
open Core | ||
open! Core | ||
open Angstrom | ||
|
||
let lowercase = function | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
lwt | ||
SZXX | ||
|
||
utils | ||
flow_parser | ||
) | ||
(preprocess (pps | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
open! Core | ||
open SZXX | ||
|
||
let parser = | ||
Angstrom.many | ||
Xml.(make_parser { accept_html_boolean_attributes = true; accept_unquoted_attributes = true }) | ||
|
||
let finalize ~filename ll = | ||
let finalize ll = | ||
List.fold_result ll ~init:Xml.SAX.To_DOM.init ~f:(fun acc x -> | ||
Xml.SAX.To_DOM.folder ~strict:false (Ok acc) x) | ||
|> function | ||
| Error err -> failwithf "Syntax error in %s: %s" filename err () | ||
| Ok Xml.SAX.To_DOM.{ top; _ } -> top | ||
| Error _ as err -> err | ||
| Ok Xml.SAX.To_DOM.{ top = None; _ } -> Error "No root HTML element" | ||
| Ok Xml.SAX.To_DOM.{ top = Some x; _ } -> Ok x | ||
|
||
let parser = | ||
let open Angstrom in | ||
many Xml.(make_parser { accept_html_boolean_attributes = true; accept_unquoted_attributes = true }) | ||
>>= fun ll -> | ||
match finalize ll with | ||
| Ok x -> return x | ||
| Error msg -> fail msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
open! Core | ||
|
||
type identifier = { parts: string list } [@@deriving yojson, sexp] | ||
|
||
type selector = | ||
| Element of identifier | ||
| Class of identifier | ||
| Id of identifier | ||
[@@deriving yojson, sexp] | ||
|
||
type argument = { | ||
prefix: string option; | ||
identifier: identifier; | ||
contents: string option; | ||
} | ||
[@@deriving yojson, sexp] | ||
|
||
type node = { | ||
selector: selector; | ||
arguments: argument list; | ||
text: string option; | ||
children: node array; | ||
} | ||
[@@deriving yojson, sexp] | ||
|
||
type t = node array [@@deriving yojson, sexp] | ||
|
||
val parser : node array Angstrom.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
open Core | ||
open! Core | ||
|
||
type raw = | ||
| JS of string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
open Core | ||
open! Core | ||
|
||
type line = | ||
| Translation of (string * string) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
open Core | ||
open! Core | ||
|
||
type raw = | ||
| HTML of string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters