Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
746343f3
Commit
746343f3
authored
Jul 26, 2017
by
Evan W. Patton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add is-text? block to test for whether a value is a string
Change-Id: Ib30e302ecf5f19970532bab66e409e50aed08b40
parent
6e23c47c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
9 deletions
+48
-9
appinventor/blocklyeditor/src/blocks/text.js
appinventor/blocklyeditor/src/blocks/text.js
+15
-1
appinventor/blocklyeditor/src/generators/yail/text.js
appinventor/blocklyeditor/src/generators/yail/text.js
+15
-2
appinventor/blocklyeditor/src/msg/en/_messages.js
appinventor/blocklyeditor/src/msg/en/_messages.js
+6
-1
appinventor/blocklyeditor/src/versioning.js
appinventor/blocklyeditor/src/versioning.js
+5
-2
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
...c/com/google/appinventor/components/common/YaVersion.java
+7
-3
No files found.
appinventor/blocklyeditor/src/blocks/text.js
View file @
746343f3
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2013-201
4
MIT, All rights reserved
// Copyright 2013-201
7
MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
/**
...
...
@@ -474,3 +474,17 @@ Blockly.Blocks['obfuscated_text'] = {
},
typeblock
:
[{
translatedName
:
Blockly
.
Msg
.
LANG_TEXT_TEXT_OBFUSCATE
}]
};
Blockly
.
Blocks
[
'
text_is_string
'
]
=
{
category
:
'
Text
'
,
helpUrl
:
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_HELPURL
,
init
:
function
()
{
this
.
setColour
(
Blockly
.
TEXT_CATEGORY_HUE
);
this
.
appendValueInput
(
'
ITEM
'
)
.
appendField
(
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_TITLE
)
.
appendField
(
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_INPUT_THING
);
this
.
setOutput
(
true
,
Blockly
.
Blocks
.
Utilities
.
YailTypeToBlocklyType
(
"
boolean
"
,
Blockly
.
Blocks
.
Utilities
.
OUTPUT
));
this
.
setTooltip
(
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_TOOLTIP
);
},
typeblock
:
[{
translatedName
:
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_TITLE
}]
};
appinventor/blocklyeditor/src/generators/yail/text.js
View file @
746343f3
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2012 Massachusetts Institute of Technology. All rights reserved.
// Copyright 2012
-2017
Massachusetts Institute of Technology. All rights reserved.
/**
* @license
* @fileoverview
Color
blocks yail generators for Blockly, modified for MIT App Inventor.
* @fileoverview
Text
blocks yail generators for Blockly, modified for MIT App Inventor.
* @author mckinney@mit.edu (Andrew F. McKinney)
*/
...
...
@@ -304,3 +304,16 @@ Blockly.Yail['obfuscated_text'] = function() {
+
Blockly
.
Yail
.
YAIL_DOUBLE_QUOTE
+
Blockly
.
Yail
.
YAIL_CLOSE_COMBINATION
;
return
[
code
,
Blockly
.
Yail
.
ORDER_ATOMIC
];
};
Blockly
.
Yail
[
'
text_is_string
'
]
=
function
()
{
// Check if the argument is a string
var
argument0
=
Blockly
.
Yail
.
valueToCode
(
this
,
'
ITEM
'
,
Blockly
.
Yail
.
ORDER_NONE
)
||
Blockly
.
Yail
.
YAIL_FALSE
;
var
code
=
Blockly
.
Yail
.
YAIL_CALL_YAIL_PRIMITIVE
+
"
string?
"
+
Blockly
.
Yail
.
YAIL_SPACER
;
code
=
code
+
Blockly
.
Yail
.
YAIL_OPEN_COMBINATION
+
Blockly
.
Yail
.
YAIL_LIST_CONSTRUCTOR
+
Blockly
.
Yail
.
YAIL_SPACER
;
code
=
code
+
argument0
;
code
=
code
+
Blockly
.
Yail
.
YAIL_SPACER
+
Blockly
.
Yail
.
YAIL_CLOSE_COMBINATION
;
code
=
code
+
Blockly
.
Yail
.
YAIL_SPACER
+
Blockly
.
Yail
.
YAIL_QUOTE
+
Blockly
.
Yail
.
YAIL_OPEN_COMBINATION
;
code
=
code
+
"
any
"
+
Blockly
.
Yail
.
YAIL_CLOSE_COMBINATION
+
Blockly
.
Yail
.
YAIL_SPACER
;
code
=
code
+
Blockly
.
Yail
.
YAIL_DOUBLE_QUOTE
+
"
is a string?
"
+
Blockly
.
Yail
.
YAIL_DOUBLE_QUOTE
+
Blockly
.
Yail
.
YAIL_CLOSE_COMBINATION
;
return
[
code
,
Blockly
.
Yail
.
ORDER_ATOMIC
];
};
appinventor/blocklyeditor/src/msg/en/_messages.js
View file @
746343f3
...
...
@@ -5,7 +5,7 @@
* Visual Blocks Language
*
* Copyright © 2012 Google Inc.
* Copyright © 2012-201
6
Massachusetts Institute of Technology
* Copyright © 2012-201
7
Massachusetts Institute of Technology
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -710,6 +710,11 @@ Blockly.Msg.en.switch_language_to_english = {
Blockly
.
Msg
.
LANG_TEXT_REPLACE_ALL_TOOLTIP
=
'
Returns a new text obtained by replacing all occurrences
\n
'
+
'
of the segment with the replacement.
'
;
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_HELPURL
=
'
http://appinventor.mit.edu/explore/ai2/support/blocks/text#isstring
'
;
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_TITLE
=
'
is a string?
'
;
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_INPUT_THING
=
'
thing
'
;
Blockly
.
Msg
.
LANG_TEXT_TEXT_IS_STRING_TOOLTIP
=
'
Returns true if <code>thing</code> is a string.
'
;
// Lists Blocks.
Blockly
.
Msg
.
LANG_CATEGORY_LISTS
=
'
Lists
'
;
//Blockly.Msg.LANG_LISTS_CREATE_EMPTY_HELPURL = 'http://en.wikipedia.org/wiki/Linked_list#Empty_lists';
...
...
appinventor/blocklyeditor/src/versioning.js
View file @
746343f3
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright © 2013-201
6
Massachusetts Institute of Technology, All rights reserved
// Copyright © 2013-201
7
Massachusetts Institute of Technology, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
/**
...
...
@@ -1667,7 +1667,10 @@ Blockly.Versioning.AllUpgradeMaps =
// AI2: In BLOCKS_LANGUAGE_VERSION 20// Rename 'obsufcated_text' text block to 'obfuscated_text'
20
:
Blockly
.
Versioning
.
renameBlockType
(
'
obsufcated_text
'
,
'
obfuscated_text
'
)
20
:
Blockly
.
Versioning
.
renameBlockType
(
'
obsufcated_text
'
,
'
obfuscated_text
'
),
// AI2: Added is a string? block to test whether values are strings.
21
:
"
noUpgrade
"
},
// End Language upgraders
...
...
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
View file @
746343f3
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-201
2
MIT, All rights reserved
// Copyright 2011-201
7
MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
...
...
@@ -399,8 +399,10 @@ public class YaVersion {
// - FORM_COMPONENT_VERSION was incremented to 20
// For YOUNG_ANDROID_VERSION_160:
// - FORM_COMPONENT_VERSION was incremented to 21
// For YOUNG_ANDROID_VERSION_161:
// - BLOCKS_LANGUAGE_VERSION was incremented to 21
public
static
final
int
YOUNG_ANDROID_VERSION
=
16
0
;
public
static
final
int
YOUNG_ANDROID_VERSION
=
16
1
;
// ............................... Blocks Language Version Number ...............................
...
...
@@ -460,8 +462,10 @@ public class YaVersion {
// The number-convert blocks was added
// For BLOCKS_LANGUAGE_VERSION 20:
// - Spelling of "Obsfucate" was corrected to Obfuscate in Text Block
// For BLOCKS_LANGUAGE_VERSION 21:
// - The is-text block was added.
public
static
final
int
BLOCKS_LANGUAGE_VERSION
=
2
0
;
public
static
final
int
BLOCKS_LANGUAGE_VERSION
=
2
1
;
// ................................. Component Version Numbers ..................................
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment