Compare commits
No commits in common. "bb62fb3966f265a5e3e82988a1356950213d1526" and "5625e0c83a191af998e00b55847e837faed7bb04" have entirely different histories.
bb62fb3966
...
5625e0c83a
2
external/libfigure/chooser.js
vendored
2
external/libfigure/chooser.js
vendored
|
@ -14,8 +14,6 @@
|
|||
// `chooser('chooser_boolean').name => 'chooser_boolean'`
|
||||
// Choosers can be compared with ===
|
||||
|
||||
import { libfigureUniq, throw_up } from "./util.js"
|
||||
|
||||
var defined_choosers = {}
|
||||
|
||||
function defineChooser(name) {
|
||||
|
|
5
external/libfigure/dance.js
vendored
5
external/libfigure/dance.js
vendored
|
@ -1,6 +1,3 @@
|
|||
import { dancerSubstitution } from "./define-figure.js"
|
||||
import { throw_up } from "./util.js"
|
||||
|
||||
var invertPairHash = {
|
||||
ladles: "gentlespoons",
|
||||
gentlespoons: "ladles",
|
||||
|
@ -13,7 +10,7 @@ var invertPairHash = {
|
|||
// If this names 2 dancers, this returns the names for the other 2 dancers
|
||||
// it's sketchy, because it assumes 4 dancers, so only use it in contra moves.
|
||||
// Formerly known as dancers complement.
|
||||
export function invertPair(whostr, dialect) {
|
||||
function invertPair(whostr, dialect) {
|
||||
if (!whostr) {
|
||||
return "others"
|
||||
} // undefined is ok
|
||||
|
|
19
external/libfigure/define-figure.js
vendored
19
external/libfigure/define-figure.js
vendored
|
@ -8,21 +8,12 @@
|
|||
// and related support functions for dealing with figures
|
||||
|
||||
import { formalParamIsDancers } from "./param.js"
|
||||
import {
|
||||
PUNCTUATION_CHARSET_STRING,
|
||||
libfigureObjectCopy,
|
||||
longestFirstSortFn,
|
||||
parseHeyLength,
|
||||
regExpEscape,
|
||||
textInDialect,
|
||||
throw_up
|
||||
} from "./util.js"
|
||||
import { libfigureObjectCopy, throw_up } from "./util.js"
|
||||
import {
|
||||
FLATTEN_FORMAT_HTML,
|
||||
FLATTEN_FORMAT_SAFE_TEXT,
|
||||
FLATTEN_FORMAT_UNSAFE_TEXT,
|
||||
Words,
|
||||
lingoLineWords,
|
||||
words,
|
||||
} from "./words.js";
|
||||
|
||||
|
@ -127,7 +118,7 @@ export function parameter_strings(move, parameter_values, dialect) {
|
|||
return parameter_strings_or_words(move, parameter_values, dialect, false)
|
||||
}
|
||||
|
||||
export function parameter_words(move, parameter_values, dialect) {
|
||||
function parameter_words(move, parameter_values, dialect) {
|
||||
return parameter_strings_or_words(move, parameter_values, dialect, true)
|
||||
}
|
||||
|
||||
|
@ -162,7 +153,7 @@ function parameterSubstitution(formal_parameter, actual_parameter, dialect) {
|
|||
}
|
||||
|
||||
// called when we do know the parameter is a dancer
|
||||
export function dancerSubstitution(dancer_term, dialect) {
|
||||
function dancerSubstitution(dancer_term, dialect) {
|
||||
return dialect.dancers[dancer_term] || dancer_term
|
||||
}
|
||||
|
||||
|
@ -195,7 +186,7 @@ export function moveSubstitution(move_term, dialect) {
|
|||
return sub.replace(moveSubstitutionPercentSRegexp, " ").trim()
|
||||
}
|
||||
|
||||
export function moveSubstitutionWithEscape(move_term, dialect) {
|
||||
function moveSubstitutionWithEscape(move_term, dialect) {
|
||||
return dialect.moves[move_term] || move_term
|
||||
}
|
||||
|
||||
|
@ -210,7 +201,7 @@ export function moveSubstitutionWithEscape(move_term, dialect) {
|
|||
// Oh hey, the word 'form' and the word 'a' are both entered by the
|
||||
// user, and so are optional.
|
||||
// Check the specs for lots of examples.
|
||||
export function moveSubstitutionWithoutForm(
|
||||
function moveSubstitutionWithoutForm(
|
||||
move_term,
|
||||
dialect,
|
||||
add_article,
|
||||
|
|
7
external/libfigure/figure.js
vendored
7
external/libfigure/figure.js
vendored
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// keep it sorted alphabetically
|
||||
|
||||
import { param, stringParamHand, stringParamShoulders, stringParamShouldersTerse } from "./param.js"
|
||||
import { param } from "./param.js"
|
||||
import {
|
||||
defineFigure,
|
||||
defineFigureAlias,
|
||||
|
@ -15,13 +15,8 @@ import {
|
|||
goodBeatsMinFn,
|
||||
moveSubstitution,
|
||||
parameter_strings,
|
||||
parameter_words,
|
||||
moveSubstitutionWithoutForm,
|
||||
moveSubstitutionWithEscape,
|
||||
} from "./define-figure.js"
|
||||
import { dancerIsPair, heyLengthMeetTimes, indefiniteArticleFor, parseHeyLength, throw_up } from "./util.js";
|
||||
import { comma, words } from "./words.js";
|
||||
import { invertPair } from "./dance.js";
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// ALLEMANDE //
|
||||
|
|
12
external/libfigure/param.js
vendored
12
external/libfigure/param.js
vendored
|
@ -10,7 +10,7 @@
|
|||
// figures have a subject telling who's acted on by the figure.
|
||||
//
|
||||
|
||||
import { parseHeyLength, throw_up } from "./util.js"
|
||||
import { throw_up } from "./util.js"
|
||||
import { chooser, dancerMenuForChooser } from "./chooser.js"
|
||||
import {
|
||||
degreesToPlaces,
|
||||
|
@ -18,10 +18,6 @@ import {
|
|||
moveCaresAboutPlaces,
|
||||
moveCaresAboutRotations,
|
||||
} from "./move.js";
|
||||
import {
|
||||
lingoLineWords,
|
||||
} from "./words.js";
|
||||
import { dancerSubstitution, stringInDialect } from "./define-figure.js";
|
||||
|
||||
const __params = {}
|
||||
|
||||
|
@ -200,13 +196,13 @@ var stringParamClock = makeTurnStringParam(
|
|||
"____"
|
||||
)
|
||||
var stringParamLeftRight = makeTurnStringParam("left", "right", "*", "____")
|
||||
export var stringParamShoulders = makeTurnStringParam(
|
||||
var stringParamShoulders = makeTurnStringParam(
|
||||
"right shoulders",
|
||||
"left shoulders",
|
||||
"* shoulders",
|
||||
"____"
|
||||
)
|
||||
export var stringParamShouldersTerse = makeTurnStringParam(
|
||||
var stringParamShouldersTerse = makeTurnStringParam(
|
||||
"rights",
|
||||
"lefts",
|
||||
"* shoulders",
|
||||
|
@ -218,7 +214,7 @@ var stringParamHandStarHand = makeTurnStringParam(
|
|||
"* hand",
|
||||
"____"
|
||||
)
|
||||
export var stringParamHand = makeTurnStringParam("right", "left", "*", "____")
|
||||
var stringParamHand = makeTurnStringParam("right", "left", "*", "____")
|
||||
|
||||
// spin = clockwise | ccw | undefined
|
||||
defineParam("spin", {
|
||||
|
|
17
external/libfigure/util.js
vendored
17
external/libfigure/util.js
vendored
|
@ -1,8 +1,3 @@
|
|||
import { dancers, dancerMenuForChooser, chooser } from "./chooser.js"
|
||||
import { moves, parameters } from "./define-figure.js"
|
||||
import { formalParamIsDancers } from "./param.js"
|
||||
import { peek } from "./words.js"
|
||||
|
||||
export const PUNCTUATION_CHARSET_STRING =
|
||||
"[\u2000-\u206F\u2E00-\u2E7F'!\"#$%&()*+,/:;<=>?@\\[\\]^_`{|}~\\.-]"
|
||||
|
||||
|
@ -16,7 +11,7 @@ export const throw_up = str => {
|
|||
}
|
||||
|
||||
// a little weird that this takes a Words now, not a string
|
||||
export function indefiniteArticleFor(w) {
|
||||
function indefiniteArticleFor(w) {
|
||||
var str = peek(w)
|
||||
return /[aeiou]/.test(str) ? "an" : "a"
|
||||
}
|
||||
|
@ -106,7 +101,7 @@ function copyDialect(dialect) {
|
|||
}
|
||||
}
|
||||
|
||||
export function textInDialect(dialect) {
|
||||
function textInDialect(dialect) {
|
||||
// see also ruby-side implementation
|
||||
return !!dialect.text_in_dialect
|
||||
}
|
||||
|
@ -120,7 +115,7 @@ export const libfigureObjectCopy = hash => {
|
|||
return o
|
||||
}
|
||||
|
||||
export function libfigureUniq(array) {
|
||||
function libfigureUniq(array) {
|
||||
// suboptimal O(n^2)
|
||||
var output = []
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
|
@ -162,7 +157,7 @@ function figuresUseDancers(figures, dancers_term) {
|
|||
}
|
||||
|
||||
// unpacks a hey length into a pair, [dancer, meeting_count] or ['full', meeting_count]
|
||||
export function parseHeyLength(hey_length) {
|
||||
function parseHeyLength(hey_length) {
|
||||
if (hey_length === "full" || hey_length === "between half and full") {
|
||||
return [hey_length, 2]
|
||||
} else if (hey_length === "half" || hey_length === "less than half") {
|
||||
|
@ -180,11 +175,11 @@ export function parseHeyLength(hey_length) {
|
|||
throw_up("unparseable hey length - " + hey_length)
|
||||
}
|
||||
|
||||
export function heyLengthMeetTimes(hey_length) {
|
||||
function heyLengthMeetTimes(hey_length) {
|
||||
return parseHeyLength(hey_length)[1]
|
||||
}
|
||||
|
||||
export function dancerIsPair(dancer) {
|
||||
function dancerIsPair(dancer) {
|
||||
return dancerMenuForChooser(chooser("chooser_pair")).indexOf(dancer) >= 0
|
||||
}
|
||||
|
||||
|
|
3
external/libfigure/words.js
vendored
3
external/libfigure/words.js
vendored
|
@ -2,7 +2,6 @@ import {
|
|||
longestFirstSortFn,
|
||||
PUNCTUATION_CHARSET_STRING,
|
||||
regExpEscape,
|
||||
throw_up,
|
||||
} from "./util.js"
|
||||
import { dancers } from "./chooser.js"
|
||||
import { moves } from "./define-figure.js"
|
||||
|
@ -11,7 +10,7 @@ export function Words(arr) {
|
|||
this.arr = arr
|
||||
}
|
||||
|
||||
export const words = function () {
|
||||
export const words = function() {
|
||||
return new Words(Array.prototype.slice.call(arguments))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user