summaryrefslogtreecommitdiff
path: root/devel/omake/files/patch-src_libmojave-external_stdlib_lm__string__util.ml
blob: 724c55d42d53ad09bd638e3398fb7ee7bb8b8c73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
$NetBSD: patch-ar,v 1.1 2010/12/17 09:40:14 wiz Exp $

From upstream SVN.

--- src/libmojave-external/stdlib/lm_string_util.ml.orig	2008-06-28 01:21:34.000000000 +0000
+++ src/libmojave-external/stdlib/lm_string_util.ml
@@ -613,18 +613,13 @@ let tokens_create wrap group =
  * Get the tokens list.
  *)
 let tokens_flush info =
-   let { tokens_group  = group;
-         tokens_list   = tokens;
-         tokens_prefix = prefix
-       } = info
-   in
    let tokens =
-      match prefix with
+      match info.tokens_prefix with
          NoPrefix ->
-            tokens
+            info.tokens_list
        | WordPrefix prefix
        | QuotePrefix (_, prefix) ->
-            group prefix :: tokens
+            info.tokens_group prefix :: info.tokens_list
    in
       List.rev tokens
 
@@ -632,38 +627,29 @@ let tokens_flush info =
  * End the current word.
  *)
 let tokens_break info =
-   let { tokens_group  = group;
-         tokens_list   = tokens;
-         tokens_prefix = prefix
-       } = info
-   in
-      match prefix with
-         NoPrefix ->
-            info
-       | WordPrefix prefix
-       | QuotePrefix (_, prefix) ->
-            { info with tokens_list   = group prefix :: tokens;
-                        tokens_prefix = NoPrefix
-            }
+   match info.tokens_prefix with
+      NoPrefix ->
+         info
+    | WordPrefix prefix
+    | QuotePrefix (_, prefix) ->
+         { info with tokens_list   = info.tokens_group prefix :: info.tokens_list;
+                     tokens_prefix = NoPrefix
+         }
 
 (*
  * Add a value directly.
  * This also performs a break.
  *)
 let tokens_atomic info x =
-   let { tokens_group  = group;
-         tokens_list   = tokens;
-         tokens_prefix = prefix
-       } = info
-   in
-      match prefix with
+   let tokens = info.tokens_list in
+      match info.tokens_prefix with
          NoPrefix ->
             { info with tokens_list   = x :: tokens;
                         tokens_prefix = NoPrefix
             }
        | WordPrefix prefix
        | QuotePrefix (_, prefix) ->
-            { info with tokens_list   = x :: group prefix :: tokens;
+            { info with tokens_list   = x :: info.tokens_group prefix :: tokens;
                         tokens_prefix = NoPrefix
             }
 
@@ -758,11 +744,8 @@ let tokens_string info s =
       if len = 0 then
          info
       else
-         let { tokens_list = tokens;
-               tokens_prefix = prefix
-             } = info
-         in
-            match prefix with
+         let tokens = info.tokens_list in
+            match info.tokens_prefix with
                NoPrefix ->
                   scan_white tokens 0
              | WordPrefix prefix ->
@@ -809,13 +792,11 @@ let buffer_get_token lexer s i len =
                BufChar
 
 let tokens_lex info s =
-   let { tokens_lexer       = lexer;
-         tokens_wrap_string = wrap_string;
-         tokens_wrap_data   = wrap_data;
-         tokens_wrap_token  = wrap_token;
-         tokens_group       = group
-       } = info
-   in
+   let lexer = info.tokens_lexer in
+   let wrap_string = info.tokens_wrap_string in
+   let wrap_data = info.tokens_wrap_data in
+   let wrap_token = info.tokens_wrap_token in
+   let group = info.tokens_group in
    let len = String.length s in
 
    (* Don't add empty strings *)
@@ -902,11 +883,8 @@ let tokens_lex info s =
       if len = 0 then
          info
       else
-         let { tokens_list = tokens;
-               tokens_prefix = prefix
-             } = info
-         in
-            match prefix with
+         let tokens = info.tokens_list in
+            match info.tokens_prefix with
                NoPrefix ->
                   scan_white tokens 0
              | WordPrefix prefix ->