File tree Expand file tree Collapse file tree 8 files changed +685
-0
lines changed Expand file tree Collapse file tree 8 files changed +685
-0
lines changed Original file line number Diff line number Diff line change
1
+ /target
2
+ /classes
3
+ /checkouts
4
+ profiles.clj
5
+ pom.xml
6
+ pom.xml.asc
7
+ * .jar
8
+ * .class
9
+ /.lein- *
10
+ /.nrepl-port
11
+ /.prepl-port
12
+ .hgignore
13
+ .hg /
Original file line number Diff line number Diff line change
1
+ # outs-23
2
+
3
+ Комбинаторные парсеры
4
+
5
+ ## Полезные ссылки
6
+ - комбинаторный парсер на Clojure https://github.com/strojure/parsesso
7
+ - комбинаторный парсер на Clojure https://github.com/rm-hull/jasentaa
8
+ - instaparse https://github.com/Engelberg/instaparse
9
+ - пример JSON на instaparse https://nextjournal.com/learn-ast-with-clojure/20210524
10
+ - интересный пример на instaparse https://www.toomuchcode.org/blog/2015/11/14/insta-declarative-dsls/
Original file line number Diff line number Diff line change
1
+ (defproject otus-23 " 0.1.0-SNAPSHOT"
2
+ :description " OTUS #23"
3
+ :dependencies [[org.clojure/clojure " 1.11.1" ]
4
+ [instaparse " 1.4.12" ]]
5
+ :repl-options {:init-ns otus-23.core})
Original file line number Diff line number Diff line change
1
+ document = (tag | spase)*
2
+
3
+ <tag> = html-comment | html-tag
4
+
5
+ html-comment = <comment-start> comment-content <comment-end>
6
+ <comment-content> = #'.+?(?=-->)'
7
+ <comment-start> = <'<!--'>
8
+ <comment-end> = <'-->'>
9
+
10
+ html-tag = tag-start (tag-self-close | (close-tag [spase] tag-content tag-close))
11
+
12
+ <tag-start> = open-tag tag-name [spase attrs] [spase]
13
+ tag-content = ([spase] (tag | text) [spase])*
14
+ <tag-self-close> = <'/>' [spase]>
15
+ <tag-close> = open-tag slash <tag-name> close-tag [spase]
16
+
17
+ <open-tag> = <'<'>
18
+ <close-tag> = <'>'>
19
+ <tag-name> = #'[a-zA-Z0-9_-]+' | '!DOCTYPE' | '!doctype'
20
+
21
+ attrs = (attr [spase])*
22
+ <attr> = attr-w-value | attr-wo-value
23
+ <attr-w-value> = attr-name <'='> attr-value
24
+ <attr-wo-value> = attr-name
25
+ <attr-name> = #'[a-zA-Z0-9_\-\:]+'
26
+ <attr-value> = quot string quot
27
+
28
+ text = #'[^<\n]+(?=<[\w\/])' | #'[^<]+(?=\n)'
29
+ <spase> = <#'[ \t\n]+'>
30
+ <word-with-digit> = #'[\w\d]+'
31
+ <string> = #'[^"]*'
32
+ <quot> = <'"'>
33
+ <slash> = <'/'>
Original file line number Diff line number Diff line change
1
+ < html lang ="en ">
2
+ < head >
3
+ < meta charset ="UTF-8 "/>
4
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 "/>
5
+ < meta http-equiv ="X-UA-Compatible " content ="ie=edge "/>
6
+ < title > My Website</ title >
7
+ < link rel ="stylesheet " href ="./style.css "/>
8
+ < link rel ="icon " href ="./favicon.ico " type ="image/x-icon "/>
9
+ </ head >
10
+ < body >
11
+ < main >
12
+ < h1 > Welcome to My Website</ h1 >
13
+ </ main >
14
+ < script src ="index.js "> </ script >
15
+ </ body >
16
+ </ html >
Original file line number Diff line number Diff line change
1
+ {
2
+ "id" : " 0001" ,
3
+ "type" : " donut" ,
4
+ "name" : " Cake" ,
5
+ "ppu" : 0.55 ,
6
+ "batters" : {
7
+ "batter" : [
8
+ {
9
+ "id" : " 1001" ,
10
+ "type" : " Regular"
11
+ },
12
+ {
13
+ "id" : " 1002" ,
14
+ "type" : " Chocolate"
15
+ },
16
+ {
17
+ "id" : " 1003" ,
18
+ "type" : " Blueberry"
19
+ },
20
+ {
21
+ "id" : " 1004" ,
22
+ "type" : " Devil's Food"
23
+ }
24
+ ]
25
+ },
26
+ "topping" : [
27
+ {
28
+ "id" : " 5001" ,
29
+ "type" : " None"
30
+ },
31
+ {
32
+ "id" : " 5002" ,
33
+ "type" : " Glazed"
34
+ },
35
+ {
36
+ "id" : " 5005" ,
37
+ "type" : " Sugar"
38
+ },
39
+ {
40
+ "id" : " 5007" ,
41
+ "type" : " Powdered Sugar"
42
+ },
43
+ {
44
+ "id" : " 5006" ,
45
+ "type" : " Chocolate with Sprinkles"
46
+ },
47
+ {
48
+ "id" : " 5003" ,
49
+ "type" : " Chocolate"
50
+ },
51
+ {
52
+ "id" : " 5004" ,
53
+ "type" : " Maple"
54
+ }
55
+ ]
56
+ }
You can’t perform that action at this time.
0 commit comments