Skip to content

Commit dccd106

Browse files
authored
Merge pull request #14 from cgay/dev
Incompatible change for lowercase? and uppercase?
2 parents 5e39e9a + b5f5d15 commit dccd106

5 files changed

Lines changed: 41 additions & 153 deletions

File tree

documentation/source/conf.py

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# Configuration file for the Sphinx documentation builder.
2-
#
3-
# This file only contains a selection of the most common options. For a full
4-
# list see the documentation:
52
# https://www.sphinx-doc.org/en/master/usage/configuration.html
63

7-
# -- Path setup --------------------------------------------------------------
8-
9-
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
11-
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
134
import os
145
import sys
156

167
sys.path.insert(0, os.path.abspath('../../_packages/sphinx-extensions/current/src/sphinxcontrib'))
178

189
import dylan.domain
19-
import dylan.themes as dylan_themes
2010

2111
# -- Project information -----------------------------------------------------
2212

@@ -25,7 +15,7 @@
2515
author = 'Carl Gay'
2616

2717
# The full version, including alpha/beta/rc tags
28-
release = 'v1.2.0'
18+
release = 'v2.0.0'
2919

3020

3121
# -- General configuration ---------------------------------------------------
@@ -38,9 +28,6 @@
3828
'sphinx.ext.intersphinx'
3929
]
4030

41-
# Add any paths that contain templates here, relative to this directory.
42-
templates_path = ['_templates']
43-
4431
# List of patterns, relative to source directory, that match files and
4532
# directories to ignore when looking for source files.
4633
# This pattern also affects html_static_path and html_extra_path.
@@ -52,22 +39,5 @@
5239
# without depending on this top-level config file.
5340
primary_domain = 'dylan'
5441

55-
56-
# -- Options for HTML output -------------------------------------------------
57-
58-
# The theme to use for HTML and HTML Help pages. See the documentation for
59-
# a list of builtin themes.
60-
html_theme = dylan_themes.get_html_theme_default()
61-
62-
# Theme options are theme-specific and customize the look and feel of a theme
63-
# further. For a list of options available for each theme, see the
64-
# documentation.
65-
html_theme_options = dylan_themes.get_html_theme_options_default()
66-
67-
# Add any paths that contain custom themes here, relative to this directory.
68-
html_theme_path = [dylan_themes.get_html_theme_path()]
69-
70-
# Add any paths that contain custom static files (such as style sheets) here,
71-
# relative to this directory. They are copied after the builtin static files,
72-
# so a file named "default.css" will overwrite the builtin "default.css".
73-
html_static_path = ['_static']
42+
# sudo pip install -U furo
43+
html_theme = 'furo'

documentation/source/index.rst

Lines changed: 16 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The *strings* library was originally defined in `DEP-0004
1111
<http://opendylan.org/proposals/dep-0004.html>`_. Some additional background
1212
material can be found there.
1313

14-
.. contents:: Contents
15-
:local:
14+
.. toctree::
15+
:hidden:
1616

1717
.. note::
1818

@@ -671,55 +671,20 @@ Case Conversion Functions
671671
lowercase!("Hack Dylan!")
672672
=> error, attempt to modify a string constant
673673
674-
.. generic-function:: lowercase?
675-
:sealed:
674+
.. function:: lowercase?
676675

677-
Returns :drm:`#t` if the argument is entirely composed of
678-
non-uppercase characters.
679-
680-
:signature: lowercase? (string-or-character) => (is-lowercase?)
681-
:parameter string-or-character: An instance of ``type-union(<string>, <character>)``.
682-
:value is-lowercase?: An instance of :drm:`<boolean>`.
683-
684-
.. method:: lowercase?
685-
:specializer: <character>
686-
:sealed:
687-
688-
Returns :drm:`#t` if the given character is not an uppercase alphabetic.
689-
Otherwise :drm:`#f` is returned.
676+
Returns :drm:`#t` if the argument is a lowercase alphabetic character.
677+
Otherwise returns :drm:`#f`.
690678

691679
:signature: lowercase? (character) => (is-lowercase?)
692680
:parameter character: An instance of :drm:`<character>`.
693681
:value is-lowercase?: An instance of :drm:`<boolean>`.
694-
:example:
695-
696-
.. code-block:: dylan
697682

698-
lowercase?('n') => #t
699-
lowercase?('N') => #f
700-
lowercase?('*') => #t
701-
702-
.. method:: lowercase?
703-
:specializer: <string>
704-
:sealed:
705-
706-
Returns :drm:`#t` if the argument does not contain any uppercase
707-
alphabetic characters. Otherwise :drm:`#f` is returned.
708-
709-
:signature: lowercase? (string) => (is-lowercase?)
710-
:parameter string: An instance of :drm:`<string>`.
711-
:parameter #key start: An instance of :drm:`<integer>`, default 0. The index
712-
at which to start checking.
713-
:parameter #key end: An instance of :drm:`<integer>`, default
714-
``string.size``. The index before which to stop checking.
715-
:value is-lowercase?: An instance of :drm:`<boolean>`.
716-
:example:
717-
718-
.. code-block:: dylan
683+
.. code-block:: dylan
719684
720-
lowercase?("Why me?") => #f
721-
lowercase?("Why me?", start: 1) => #t
722-
lowercase?("e.e. cummings") => #t
685+
lowercase?('n') => #t
686+
lowercase?('N') => #f
687+
lowercase?('*') => #f
723688
724689
.. generic-function:: uppercase
725690
:sealed:
@@ -820,54 +785,21 @@ Case Conversion Functions
820785
uppercase!("Hack Dylan!")
821786
=> error, attempt to modify a string constant
822787
823-
.. generic-function:: uppercase?
824-
:sealed:
825-
826-
Returns :drm:`#t` if the argument is entirely composed of
827-
non-lowercase characters.
828-
829-
:signature: uppercase? (string-or-character) => (is-uppercase?)
830-
:parameter string-or-character: An instance of ``type-union(<string>, <character>)``.
831-
:value is-uppercase?: An instance of :drm:`<boolean>`.
788+
.. function:: uppercase?
832789

833-
.. method:: uppercase?
834-
:specializer: <character>
835-
:sealed:
836-
837-
Returns :drm:`#t` if the given character is not a lowercase alphabetic.
838-
Otherwise :drm:`#f` is returned.
790+
Returns :drm:`#t` if the argument is an uppercase alphabetic character.
791+
Otherwise returns :drm:`#f`.
839792

840793
:signature: uppercase? (character) => (is-uppercase?)
841794
:parameter character: An instance of :drm:`<character>`.
842795
:value is-uppercase?: An instance of :drm:`<boolean>`.
843-
:example:
844-
845-
.. code-block:: dylan
846-
847-
uppercase?('T') => #t
848-
uppercase?('t') => #f
849-
uppercase?('^') => #t
850-
851-
.. method:: uppercase?
852-
:specializer: <string>
853-
:sealed:
854-
855-
Returns :drm:`#t` if the argument does not contain any lowercase
856-
alphabetic characters. Otherwise :drm:`#f` is returned.
857796

858-
:signature: uppercase? (string) => (is-uppercase?)
859-
:parameter string: An instance of :drm:`<string>`.
860-
:parameter #key start: An instance of :drm:`<integer>`, default 0. The index
861-
at which to start checking.
862-
:parameter #key end: An instance of :drm:`<integer>`, default
863-
``string.size``. The index before which to stop checking.
864-
:value is-uppercase?: An instance of :drm:`<boolean>`.
865-
:example:
797+
.. code-block:: dylan
866798
867-
.. code-block:: dylan
799+
uppercase?('T') => #t
800+
uppercase?('t') => #f
801+
uppercase?('^') => #f
868802
869-
uppercase?("AbC") => #f
870-
uppercase?("ABC") => #t
871803
872804
Comparison Functions
873805
--------------------

dylan-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
],
88
"description": "String manipulation functions",
99
"name": "strings",
10-
"version": "1.2.0",
10+
"version": "2.0.0",
1111
"url": "https://github.com/dylan-lang/strings"
1212
}

strings.dylan

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -129,43 +129,21 @@ define method whitespace?
129129
end;
130130

131131

132-
// Returns #t if the required argument could be a value returned from
133-
// 'as-uppercase'. In other words, if the argument does NOT contain
134-
// any lowercase characters.
135132
define sealed generic uppercase?
136-
(string-or-character :: <string-or-char>, #key) => (uppercase? :: <boolean>);
133+
(char :: <character>) => (uppercase? :: <boolean>);
137134

138135
define inline method uppercase?
139-
(char :: <character>, #key) => (b :: <boolean>)
140-
~lowercase-code?(as(<integer>, char))
141-
end;
142-
143-
define method uppercase?
144-
(string :: <string>,
145-
#key start :: <integer> = 0,
146-
end: epos :: <integer> = string.size)
147-
=> (b :: <boolean>)
148-
%every?(uppercase?, string, start, epos)
136+
(char :: <character>) => (b :: <boolean>)
137+
uppercase-code?(as(<integer>, char))
149138
end;
150139

151140

152-
// Returns #t if the required argument could be a value returned from
153-
// 'as-lowercase'. In other words, if the argument does NOT contain
154-
// any uppercase characters.
155141
define sealed generic lowercase?
156-
(string-or-character :: <string-or-char>, #key) => (lowercase? :: <boolean>);
142+
(char :: <character>) => (lowercase? :: <boolean>);
157143

158144
define inline method lowercase?
159-
(char :: <character>, #key) => (b :: <boolean>)
160-
~uppercase-code?(as(<integer>, char))
161-
end;
162-
163-
define method lowercase?
164-
(string :: <string>,
165-
#key start :: <integer> = 0,
166-
end: epos :: <integer> = string.size)
167-
=> (b :: <boolean>)
168-
%every?(lowercase?, string, start, epos)
145+
(char :: <character>) => (b :: <boolean>)
146+
lowercase-code?(as(<integer>, char))
169147
end;
170148

171149

tests/strings-test-suite.dylan

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,16 +405,24 @@ end test;
405405

406406
define test test-lowercase? ()
407407
check-true("a", lowercase?('a'));
408-
check-true("b", lowercase?("abc-$#^^10"));
409-
check-false("c", lowercase?('A'));
410-
check-false("d", lowercase?("aBc-$#^^10"));
408+
check-true("z", lowercase?('z'));
409+
check-false("A", lowercase?('A'));
410+
check-false("Z", lowercase?('Z'));
411+
check-false("@", lowercase?('@'));
412+
check-false("[", lowercase?('['));
413+
check-false("`", lowercase?('`'));
414+
check-false("{", lowercase?('{'));
411415
end test;
412416

413417
define test test-uppercase? ()
414-
check-true("a", uppercase?('X'));
415-
check-true("b", uppercase?("ABC-$#^^10"));
416-
check-false("c", uppercase?('b'));
417-
check-false("d", uppercase?("aBc-$#^^10"));
418+
check-true("A", uppercase?('A'));
419+
check-true("Z", uppercase?('Z'));
420+
check-false("a", uppercase?('a'));
421+
check-false("z", uppercase?('z'));
422+
check-false("@", uppercase?('@'));
423+
check-false("[", uppercase?('['));
424+
check-false("`", uppercase?('`'));
425+
check-false("{", uppercase?('{'));
418426
end test;
419427

420428

0 commit comments

Comments
 (0)